blob: ad858c5637e0d1335a0a661228fc4a473d5ebbe6 (
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
|
package com.juick.console;
import com.juick.console.configuration.ConsoleAppConfiguration;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.env.SimpleCommandLinePropertySource;
import java.io.IOException;
/**
* Created by vitalyster on 30.08.2016.
*/
public class Console {
public static void main(String ...args) throws IOException {
final AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
// setup configuration
applicationContext.register(ConsoleAppConfiguration.class);
// add CLI property source
applicationContext.getEnvironment().getPropertySources()
.addLast(new SimpleCommandLinePropertySource(args));
// setup all the dependencies (refresh) and make them run (start)
applicationContext.refresh();
applicationContext.start();
applicationContext.getBean(ConsoleApp.class).start();
}
}
|