Difference between ExitCodeGenerator and System.exit(0)
问题 I recently learned that the proper way to shut down a Spring Boot application is this: public class Application { @Bean public ExitCodeGenerator exitCodeGenerator() { return new ExitCodeGenerator() { @Override public int getExitCode() { return 0; } }; } public static void main(String[] args) throws Exception { System.exit(SpringApplication.exit(SpringApplication.run(Application.class, args))); } } This should return an exit code of 0, or whatever I configure it to return in the getExitCode()