ieXcept
ieXcept

Reputation: 1127

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?

Upvotes: 7

Views: 6117

Answers (3)

Jeen
Jeen

Reputation: 391

spring boot version : 2.0.1.RELEASE

pom.xml

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

application.properties

management.endpoints.web.exposure.include=shutdown
management.endpoint.shutdown.enabled=true

then, try

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

Upvotes: 10

Evan Knox Thomas
Evan Knox Thomas

Reputation: 590

spring-boot 2.0 default
management.endpoints.web.exposure.include=info, health,
change to
management.endpoints.web.exposure.include=info, health, shutdown

Upvotes: 6

Andy Wilkinson
Andy Wilkinson

Reputation: 116281

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.

Upvotes: 12

Related Questions