We are developing a spring boot and spring batch application using gradle. We will be deploying this application on a linux environment.
we are using distTar to generate a tar using application plugin.
We register a shutdown hook to close the context and do some other stuff before the application is being shutdown.
When we run the application from eclipse as a Spring Boot Application, the shutdown hook is executing, but when we run it on linux with the startup script generated by gradle plugin, the shutdown hook is not executing.
How do we deploy spring boot applications in production linux environments? How to make sure that the shutdown hook is being executed.
When I say its not executing, when I do a CTRC+C or a kill -9 , the statements in the shutdown hook and the methods annotated with @PreDestroy methods are not printed/executed.
Looking for options to gracefully shutdown the application by closing the context.