Example usage for org.springframework.boot ExitCodeGenerator getExitCode

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

Introduction

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

Prototype

int getExitCode();

Source Link

Document

Returns the exit code that should be returned from the application.

Usage

From source file:org.springframework.boot.SpringApplication.java

private static int getExitCode(List<ExitCodeGenerator> exitCodeGenerators) {
    int exitCode = 0;
    for (ExitCodeGenerator exitCodeGenerator : exitCodeGenerators) {
        try {//from  ww w .  ja v a2  s.  c  om
            int value = exitCodeGenerator.getExitCode();
            if (value > 0 && value > exitCode || value < 0 && value < exitCode) {
                exitCode = value;
            }
        } catch (Exception ex) {
            exitCode = (exitCode == 0 ? 1 : exitCode);
            ex.printStackTrace();
        }
    }
    return exitCode;
}