When a Spring Boot process exits normally, Spring’s JVM shutdown hook closes the application context, runs lifecycle cleanup, and—on supported embedded web servers—stops new web work while giving in-flight requests a configured window to finish. That application-level window is separate from the time an orchestrator allows the container to terminate.
What starts Spring Boot shutdown?
Each SpringApplication registers a JVM shutdown hook. On an orderly JVM exit, the hook closes the Spring ApplicationContext; context closure then initiates Spring’s lifecycle stop and cleanup processing. Standard callbacks such as DisposableBean and @PreDestroy can release application resources. Spring Boot Reference: SpringApplication
As an Amazon Associate I earn from qualifying purchases.
A process that is forcibly killed does not get the same ordinary cleanup opportunity. In particular, a forced termination such as SIGKILL cannot be handled by the shutdown hook. Spring’s graceful-shutdown guidance also warns that an IDE may stop an application immediately if it does not send a proper SIGTERM. Spring Boot Reference: Graceful Shutdown
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsWhat happens when the application context closes?
Spring Boot performs embedded web-server graceful shutdown in the earliest phase of stopping SmartLifecycle beans. The server stops admitting new work, while active requests get a timeout window to complete before later lifecycle shutdown proceeds. The timeout is configured per shutdown phase with spring.lifecycle.timeout-per-shutdown-phase; the reference uses 20s as an example of the property’s duration syntax, not as a universal recommendation. Spring Boot Reference: Graceful Shutdown
#1 Best Overall
This web-server behavior does not automatically drain every background activity in an application. Message consumers, scheduled jobs, executors, and other application-specific components need their own lifecycle handling and suitable timeouts. If work lasts longer than the configured window or the process’s overall termination deadline, it can still be interrupted.
What do clients see while requests drain?
During graceful shutdown, new requests are not meant to begin processing, while requests already in progress are allowed time to finish. The exact network behavior is server-dependent; persistent connections can also affect when a server considers new work to have arrived. Spring’s current reference describes Jetty, Reactor Netty, and Tomcat and does not promise one universal HTTP status or wire-level response. Spring Boot Reference: Graceful Shutdown
Server differences documented for Spring Boot 3.3.13
The Spring Boot 3.3.13 reference distinguishes Undertow from Jetty, Reactor Netty, and Tomcat: Undertow can accept new connections and respond with HTTP 503, while the other three stop accepting requests at the network layer. This is a version-specific description in the 3.3.13 documentation, not a performance comparison or a guarantee for every release and connection pattern. Spring Boot 3.3.13 Reference: Graceful Shutdown
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Which shutdown settings should you configure?
The current Spring Boot reference says graceful shutdown is enabled by default for its listed embedded servers—Jetty, Reactor Netty, and Tomcat—and for reactive and servlet-based web applications. Set the phase timeout to match the time your application needs to finish in-flight work and perform cleanup. To disable graceful shutdown, the current reference documents server.shutdown=immediate. Spring Boot Reference: Graceful Shutdown
The Spring Boot 3.3.13 page shows explicit configuration with server.shutdown=graceful and a spring.lifecycle.timeout-per-shutdown-phase=20s example. Treat those as examples from that version’s documentation; choose a timeout based on your application’s work and deployment deadline, rather than copying the example as a default. Spring Boot 3.3.13 Reference: Graceful Shutdown
How does Kubernetes change the shutdown sequence?
Spring’s Kubernetes deployment guidance notes that shutdown-related systems act concurrently: Kubernetes begins terminating the pod while service routing changes are also propagating. That can leave a window in which traffic still reaches the pod. A preStop hook can introduce a delay for routing changes to take effect; Kubernetes then sends SIGTERM to the container. Spring Boot Reference: Kubernetes deployment
The same guidance identifies 30 seconds as Kubernetes’ default terminationGracePeriodSeconds. This is a Kubernetes operational default, not a Spring Boot timeout. If the application needs more time, increase the pod’s termination grace period. After the grace period expires, Kubernetes sends SIGKILL to a container that is still running. Coordinate the Spring lifecycle timeout with this overall budget, leaving time for routing, pre-stop behavior, and other cleanup; the Spring timeout alone cannot guarantee a graceful pod termination. Spring Boot Reference: Kubernetes deployment
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →How is the process exit code determined?
Cleanup and exit status are separate concerns. Spring’s lifecycle callbacks handle resource cleanup; an ExitCodeGenerator can provide the status code used by SpringApplication.exit. Setting an exit code does not replace the shutdown lifecycle or extend the time available to drain requests. Spring Boot Reference: SpringApplication
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




