package com.juick.console.configuration; import com.juick.configuration.DataConfiguration; import com.juick.console.ConsoleApp; import com.juick.server.protocol.JuickProtocol; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; /** * Created by vitalyster on 19.12.2016. */ @Configuration @ComponentScan(basePackages = {"com.juick.console", "com.juick.service", "com.juick.server.protocol"}) @Import(DataConfiguration.class) public class ConsoleAppConfiguration implements ApplicationContextAware { private ApplicationContext applicationContext; @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; } @Bean public JuickProtocol juickProtocol() { return new JuickProtocol("https://juick.com/"); } @Bean public ConsoleApp app() { return new ConsoleApp(applicationContext); } }