@Override public void run(String... args) throws Exception { shell.start(); shell.promptLoop(); shell.waitForComplete(); SpringApplication.exit(ctx); }
@Test public void testDefaultSettings() throws Exception { assertEquals(0, SpringApplication.exit(SpringApplication.run(SampleBatchApplication.class))); String output = this.outputCapture.toString(); assertTrue( "Wrong output: " + output, output.contains("completed with the following parameters")); }
public static void main(String... args) { ApplicationContext appContext = SpringApplication.run(Application.class, args); ContactService contactService = appContext.getBean(ContactService.class); System.out.println(contactService.ping()); SpringApplication.exit(appContext); }
public static void main(String[] args) throws Exception { log.info("application start..."); ApplicationContext ctx = SpringApplication.run(ApplicationConfig.class, args); String[] defName = ctx.getBeanDefinitionNames(); for (String name : defName) { log.info("beanDefinitionName={}", name); } Busboy busboy = ctx.getBean(Busboy.class); busboy.test(); SpringApplication.exit(ctx); }
@AfterClass public static void shutdown() { if (shutdownAfterRun) { logger.info("Stopping Data Flow Shell"); if (dataFlowShell != null) { dataFlowShell.stop(); } if (applicationContext != null) { logger.info("Stopping Data Flow Admin Server"); SpringApplication.exit(applicationContext); applicationContext = null; } } }
/** * Explicitly shutdown the application context. Spring guarantees that this explicit shutdown * removes the shutdown hook and therefore prevents multiple attempts at shutting down the same * context. */ public static void stop() { SpringApplication.exit(context); }
public static void main(String[] args) { final ConfigurableApplicationContext run = SpringApplication.run(HelloWorldBatchConfiguration.class, args); log.info(multiplicationOutput.toString()); System.exit(SpringApplication.exit(run)); }