public static void main(String[] args) { String mode = args != null && args.length > 0 ? args[0] : null; if (logger.isDebugEnabled()) { logger.debug("PID:" + ManagementFactory.getRuntimeMXBean().getName() + " Application mode:" + mode + " context:" + applicationContext); } if (applicationContext != null && mode != null && "stop".equals(mode)) { System.exit(SpringApplication.exit(applicationContext, new ExitCodeGenerator() { @Override public int getExitCode() { return 0; } })); } else { SpringApplication app = new SpringApplication(TestProcrunApplication.class); applicationContext = app.run(args); if (logger.isDebugEnabled()) { logger.debug("PID:" + ManagementFactory.getRuntimeMXBean().getName() + " Application started context:" + applicationContext); } } }
@RequestMapping(value = "/admin/shutdown", method = RequestMethod.GET) public void shutdown() { final int exitCode = adminService.savepoint(); ExitCodeGenerator exitCodeGenerator = new ExitCodeGenerator() { @Override public int getExitCode() { return exitCode; } }; SpringApplication.exit(Application.context, exitCodeGenerator); }
public static void main(String[] args) { System.setProperty("xml.catalog.className", CatalogImpl.class.getName()); String mode = args != null && args.length > 0 ? args[0] : null; if(LOGGER.isDebugEnabled()){ LOGGER.debug("PID:" + ManagementFactory.getRuntimeMXBean().getName() + " Application mode:" + mode + " context:" + applicationContext); } if (applicationContext != null && mode != null && "stop".equals(mode)) { System.exit(SpringApplication.exit(applicationContext, new ExitCodeGenerator() { @Override public int getExitCode() { return 0; } })); } else { applicationContext = configureApplication(new SpringApplicationBuilder()).run(args); if (LOGGER.isDebugEnabled()) { LOGGER.debug("PID:" + ManagementFactory.getRuntimeMXBean().getName() + " Application started context:" + applicationContext); } } }
/** * Stops the server. */ public void stop() { SpringApplication.exit(context, (ExitCodeGenerator) () -> 0); }
@Bean @ConditionalOnMissingBean(ExitCodeGenerator.class) public JobExecutionExitCodeGenerator jobExecutionExitCodeGenerator() { return new JobExecutionExitCodeGenerator(); }
public static void exit(){ SpringApplication.exit(appContext, new ExitCodeGenerator[0]); }
public static void main(String[] args) throws IOException, ParseException { ConfigurableApplicationContext application = SpringApplication.run(CLIApplication.class, args); SpringApplication.exit(application, new ExitCodeGenerator[0]); }