I need to add graceful shutdown for application that will be deployed using kubernetes.
I was able to find the documentation for graceful shutdown from spring boot version 2.3.0
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#web.graceful-shutdown.
There are two types of applications in which I need to add graceful shutdown
1. Spring boot application version less than 2
2. Normal Spring applications without spring boot.
kindly suggest me the best practices and approaches . Thanks in advance
Thanks, Manzoor
For a spring based application you already found the documentation.
If a webapp (without spring) wants to react before Tomcat is going down, it can implement a ServletContextListener.
If you have a generic java application, you may want to install a shutdown hook.