//To enable graceful shutdown
server.shutdown=graceful
//To configure the timeout period(here I set the time values as 1minute)
spring.lifecycle.timeout-per-shutdown-phase=1m

Ref