Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
src change Variable name Sep 14, 2019
.gitignore init Sep 11, 2019
LICENSE init Sep 11, 2019 "spring-boot-starter-actuator" with additional text Sep 16, 2019
mvnw init Sep 11, 2019
pom.xml "spring-boot-starter-actuator" with additional text Sep 16, 2019

Spring Boot Graceful Shutdown

Maven Central

This project adds graceful shutdown behavior to Spring Boot.

The project referred to "" and tried to improve it further.


Multiple branches are maintained to support multiple Spring Boot versions. The following tables show the relation between the Spring Boot version and the Spring Boot Actuator Server Config version.

Spring Boot Spring Boot Actuator Server Config Branch
2.1.x 2.1.x master


  1. The JVM receives the SIGTERM signal and starts shutting down the Spring container.
  2. A Spring EventListener listens for a ContextClosedEvent and is invoked once the shutdown is started.
  3. The EventListener updates a Spring Boot HealthIndicator and puts it "out of service".
  4. The context shutdown is delayed using a Thread.sleep to allow the load balancer to see the updated HealthIndicator status and stop forwarding requests to this instance.
  5. When the Thread.sleep is finished, the Tomcat container is gracefully shutdown. First by pausing the connector, no longer accepting new request. Next, by allowing the Tomcat thread pool a configurable amount of time to finish the active threads.
  6. Finally, the Spring context is closed.


  1. Currently this project only supports Tomcat as embedded web container for Spring Boot. ( Undertow and/or Jetty are not yet supported. )
  2. org.springframework.boot:spring-boot-starter-actuator is required


for Maven:


for Gradle:

compile 'org.springframework.boot:spring-boot-starter-actuator:X.X.X.RELEASE'
compile 'me.silvernine:spring-boot-graceful-shutdown:X.X.X'


Key Default value Description
graceful.shutdown.enabled false Indicates whether graceful shutdown is enabled or not.
graceful.shutdown.timeout 60s The number of seconds to wait for active threads to finish before shutting down the Tomcat connector.
graceful.shutdown.wait 30s The number of seconds to return "out of service" on the health page before starting the graceful shutdown.

Alternative implementations

We found several alternatives for graceful shutdown behavior in Spring Boot.


You can’t perform that action at this time.