A shutdown is an endpoint that helps application to be shut down properly.
This feature is not enabled by default.
However, you can use it by setting command: management.endpoint.shutdown.enabled=true in your application.properties file.
xxxxxxxxxx
ConfigurableApplicationContext ctx = new SpringApplicationBuilder(Application.class)
.web(WebApplicationType.NONE).run();
int exitCode = SpringApplication.exit(ctx, new ExitCodeGenerator() {
@Override
public int getExitCode() {
// return the error code
return 0;
}
});
System.exit(exitCode);