Closed
Description
I was using the exit code generator feature and as per the document
In addition, beans may implement the org.springframework.boot.ExitCodeGenerator interface if they wish to return a specific exit code when the application ends.
Does this bean gets called whenever a proper shut down happen, or it require a call to SpringApplication.exit static method?
For me first option is not happening on a spring boot console application i.e. no web dependency. But when I call the SpringApplication.exit static method ExitCodeGenerator.getExitCode is called but still returns exit code 0 and also it forces the tests to fail with a message that
Ensure that the context has not been closed programmatically.
example can be found here boot-exitcode