aboutsummaryrefslogtreecommitdiff
path: root/juick-demo/src/main/java/com/juick/demo/Demo.java
blob: db03e2e56481c5f2666916b3813abe3403796c3d (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.demo;

import ch.vorburger.exec.ManagedProcessException;
import com.juick.demo.configuration.DemoAppConfiguration;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.env.SimpleCommandLinePropertySource;

/**
 * Created by vitalyster on 30.08.2016.
 */
public class Demo {

    public static void main(String ...args) throws ManagedProcessException {
        final AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();

        // setup configuration
        applicationContext.register(DemoAppConfiguration.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();
        DemoApp demoApp = new DemoApp(applicationContext);
        demoApp.start();
    }
}