Search code examples
spring-bootspring-boot-actuator

How to make Spring Boot v2.0.0.M7 Actuator's shutdown work?


I created hello world Spring Boot v2.0.0.M7 app, added actuator, enabled shutdown and it isn't working.

application.properties

server.port=8082
endpoint.shutdown.enabled=true
endpoint.shutdown.sensitive=false

health works fine

enter image description here

but not the shutdown

enter image description here

What am I doing wrong?


Solution

  • Endpoints have changed quite a bit in Spring Boot 2.0 and, as a result, your configuration is out of date. You need to enable the endpoint and also expose it over HTTP:

    management.endpoints.web.expose=*
    management.endpoint.shutdown.enabled=true
    

    As already noted in the comments, and described in the Actuator HTTP API documentation, you also need to make a POST request so accessing the endpoint in your browser won't work. You can use something like curl on the command line instead:

    $ curl -X POST localhost:8080/actuator/shutdown
    

    You can learn more about changes in Spring Boot 2.0 by reading the release notes.