aboutsummaryrefslogtreecommitdiff
path: root/juick-console/src/main/java/com/juick/console/configuration/ConsoleAppConfiguration.java
blob: 11e2609ebd2e638d295b95d4a1f0d0ab97f9f481 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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);
    }
}