intermediateCompany & Architect-Level

What is graceful shutdown in Spring Boot? How do you configure it?

Set server.shutdown=graceful and spring.lifecycle.timeout-per-shutdown-phase=30s — on SIGTERM, Spring Boot stops accepting new requests but waits for in-flight ones to finish (up to the timeout) before shutting down. Align this timeout with Kubernetes' terminationGracePeriodSeconds so the two don't fight each other.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Browse other categories →← Back to all Spring Boot & Microservices questions