diff options
author | Vitaly Takmazov | 2016-12-23 11:49:39 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-12-23 11:59:43 +0300 |
commit | 1bc50475e5a226ca3467882dc50a8264cd376159 (patch) | |
tree | dbc8a83462d83b6735ee15d9b915082b84815685 /juick-console/src/main/java/com/juick/console/Console.java | |
parent | 97f993fad0dea34b25cb5da932920971627fd972 (diff) |
juick-demo -> juick-console
Diffstat (limited to 'juick-console/src/main/java/com/juick/console/Console.java')
-rw-r--r-- | juick-console/src/main/java/com/juick/console/Console.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/juick-console/src/main/java/com/juick/console/Console.java b/juick-console/src/main/java/com/juick/console/Console.java new file mode 100644 index 00000000..9fff298f --- /dev/null +++ b/juick-console/src/main/java/com/juick/console/Console.java @@ -0,0 +1,27 @@ +package com.juick.console; + +import ch.vorburger.exec.ManagedProcessException; +import com.juick.console.configuration.ConsoleAppConfiguration; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.core.env.SimpleCommandLinePropertySource; + +/** + * Created by vitalyster on 30.08.2016. + */ +public class Console { + + public static void main(String ...args) throws ManagedProcessException { + 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(); + } +} |