Example usage for org.springframework.context ConfigurableApplicationContext start

List of usage examples for org.springframework.context ConfigurableApplicationContext start

Introduction

In this page you can find the example usage for org.springframework.context ConfigurableApplicationContext start.

Prototype

void start();

Source Link

Document

Start this component.

Usage

From source file:pkg.ContextEventHandlerMain.java

public static void main(String[] args) {
    ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml");

    // Let us raise a start event.
    context.start();

    HelloWorld obj = (HelloWorld) context.getBean("helloWorld");
    obj.getMessage();//w ww .j  a v a 2s  .  c  o m

    // Let us raise a stop event.
    context.stop();

    /*
    ContextStartedEvent Received
    Your Message : Hello World!
    ContextStoppedEvent Received
    */
}

From source file:com.alexshabanov.springrestapi.App.java

public static void main(String[] args) {
    System.out.println("Client app demo, expecting server to be available at " + APP_URL);

    final ConfigurableApplicationContext applicationContext = new AnnotationConfigApplicationContext(
            App.Config.class);
    applicationContext.start();
    try {//from  w w w  . j a v a 2 s .  c  o m
        applicationContext.getBean(Runnable.class).run();
    } finally {
        applicationContext.close();
    }
}

From source file:com.opengamma.bbg.loader.BloombergHistoricalLoader.java

private static ConfigurableApplicationContext getApplicationContext() {
    ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(CONTEXT_CONFIGURATION_PATH);
    context.start();
    return context;
}

From source file:com.opengamma.bbg.loader.BloombergSecurityFileLoader.java

private static BloombergSecurityFileLoader getBloombergSecurityFileLoader() {
    ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(CONTEXT_CONFIGURATION_PATH);
    context.start();
    BloombergSecurityFileLoader loader = (BloombergSecurityFileLoader) context.getBean("securityLoader");
    return loader;
}

From source file:com.opengamma.bbg.loader.BloombergSecurityLoaderTest.java

@Override
@BeforeMethod/*from  w w w. jav  a2s  . com*/
public void setUp() throws Exception {
    super.setUp();
    ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(
            "/com/opengamma/bbg/loader/bloomberg-security-loader-test-context.xml");
    context.start();
    _context = context;
    BloombergBulkSecurityLoader bbgSecLoader = (BloombergBulkSecurityLoader) _context
            .getBean("bbgBulkSecurityLoader");
    _securityMaster = _context.getBean(getDatabaseType() + "DbSecurityMaster", SecurityMaster.class);
    _securityLoader = new BloombergSecurityLoader(_securityMaster, bbgSecLoader);
}

From source file:com.opengamma.bbg.loader.BloombergSwaptionFileLoader.java

private static BloombergReferenceDataProvider getBloombergSecurityFileLoader() {
    ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(CONTEXT_CONFIGURATION_PATH);
    context.start();
    BloombergReferenceDataProvider dataProvider = (BloombergReferenceDataProvider) context
            .getBean("refDataProvider");
    return dataProvider;
}