Example usage for org.springframework.boot ExitCodeGenerator ExitCodeGenerator

List of usage examples for org.springframework.boot ExitCodeGenerator ExitCodeGenerator

Introduction

In this page you can find the example usage for org.springframework.boot ExitCodeGenerator ExitCodeGenerator.

Prototype

ExitCodeGenerator

Source Link

Usage

From source file:com.evolveum.midpoint.web.boot.MidPointSpringApplication.java

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);
    }//from  w w w.j a  v  a 2 s  . c om

    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);
        }

    }

}