Example usage for org.springframework.context ConfigurableApplicationContext close

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

Introduction

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

Prototype

@Override
void close();

Source Link

Document

Close this application context, releasing all resources and locks that the implementation might hold.

Usage

From source file:br.com.autonomiccs.wakeonlan.initialization.InicializeSystem.java

public static void main(String[] args) {
    ConfigurableApplicationContext applicationContext = SpringApplication.run(InicializeSystem.class, args);
    applicationContext.close();
}

From source file:ch.vorburger.mariadb4j.springframework.boot.MariaDB4jApplication.java

public static void main(String[] args) throws Exception {
    SpringApplication app = new SpringApplication(MariaDB4jApplication.class);
    app.setBannerMode(Mode.OFF);/*from  ww  w . j  a v  a2s  . c om*/
    ConfigurableApplicationContext ctx = app.run(args);

    MariaDB4jService.waitForKeyPressToCleanlyExit();

    ctx.stop();
    ctx.close();
}

From source file:net.cristcost.test.jpa.SpringLauncher.java

/**
 * @param args//from  ww w  . j  a va  2  s .  c  o  m
 * @throws IOException
 * @throws InterruptedException
 */
public static void main(String[] args) throws IOException {

    ConfigurableApplicationContext springContext = new ClassPathXmlApplicationContext(
            "META-INF/spring/beans.xml");

    System.out.println("Press ENTER to exit");
    System.in.read();

    System.out.println("exit");
    springContext.close();
}

From source file:com.hazelcast.hibernate.app.Main.java

public static void main(String[] args) throws Exception {
    LogManager.getLogManager().reset();
    SLF4JBridgeHandler.install();//from ww  w. j  ava 2s.  c  om

    ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext("/app-context.xml");
    Executor executor = applicationContext.getBean(Executor.class);

    // Start and wait for finishing work
    executor.execute();

    applicationContext.close();
}

From source file:org.springintegration.SpringIntegrationTest.java

public static void main(String[] args) throws Exception {

    ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(
            "/META-INF/spring/integration/spring-integration-context.xml", SpringIntegrationTest.class);
    System.out.println("Hit Enter to terminate");
    System.in.read();/* ww  w  .j  a v a  2s  .c o m*/
    context.close();
}

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();//from   ww w.jav a  2 s.  c o m
    try {
        applicationContext.getBean(Runnable.class).run();
    } finally {
        applicationContext.close();
    }
}

From source file:org.jasig.irclog.BotRunner.java

public static void main(String[] args) throws Exception {
    Log4jConfigurer.initLogging("classpath:log4j.properties", 10000);
    try {/*from   w ww  . ja  v  a2s .c  o m*/
        final ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext(
                "/applicationContext.xml", "/loggerContext.xml");

        final ShutdownHandler shutdownHandler = applicationContext.getBean(ShutdownHandler.class);

        shutdownHandler.waitForShutdown();
        applicationContext.close();
    } catch (Exception e) {
        LOG.error("Failed to start ClassPathXmlApplicationContext", e);
    } finally {
        Log4jConfigurer.shutdownLogging();
    }
}

From source file:org.s1p.app2.S1pKafkaApplication.java

public static void main(String[] args) throws Exception {
    ConfigurableApplicationContext context = new SpringApplicationBuilder(S1pKafkaApplication.class).web(false)
            .run(args);//  ww  w . j  av a2  s. c  om
    TestBean testBean = context.getBean(TestBean.class);
    testBean.send("foo");
    context.getBean(Listener.class).latch.await(60, TimeUnit.SECONDS);
    context.close();
}

From source file:org.s1p.app5.S1pKafkaApplication.java

public static void main(String[] args) throws Exception {
    ConfigurableApplicationContext context = new SpringApplicationBuilder(S1pKafkaApplication.class).web(false)
            .run(args);// w  ww  .  j  a  v  a2  s .co m
    TestBean testBean = context.getBean(TestBean.class);
    testBean.send(new Foo("foo", "bar"));
    context.getBean(Listener.class).latch.await(60, TimeUnit.SECONDS);
    context.close();
}

From source file:org.s1p.app6.S1pKafkaApplication.java

public static void main(String[] args) throws Exception {
    ConfigurableApplicationContext context = new SpringApplicationBuilder(S1pKafkaApplication.class).web(false)
            .run(args);//from  w w  w.j  av a 2  s  . c o  m
    TestBean testBean = context.getBean(TestBean.class);
    testBean.send(new GenericMessage<>(new Foo("foo", "bar")));
    context.getBean(Listener.class).latch.await(60, TimeUnit.SECONDS);
    context.close();
}