Reputation: 18760
I am trying to add a shutdown endpoint actuator/shutdown
in my Spring application as explained in this tutorial so that I can gracefully shutdown the application using a call like curl -X POST localhost:8080/actuator/shutdown
.
I added
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
to my pom.xml
and
management:
endpoints.web.exposure.include: *
endpoint.shutdown.enabled: true
endpoints.shutdown.enabled: true
management.endpoint.shutdown.enabled: true
to src/main/resources/application.yaml
.
But when I run curl -X POST localhost:8080/actuator/shutdown
, I get the following response:
{"timestamp":"2020-04-10T10:49:36.758+0000","status":404,"error":"Not Found",
"message":"No message available","path":"/actuator/shutdown"}
I don't see the shutdown endpoint at http://localhost:8080/actuator
:
What am I doing wrong? What do I need to change in order for the actuator/shutdown
endpoint to appear?
Upvotes: 2
Views: 2007
Reputation: 11246
It appears you are using yaml, *
has a special meaning in yaml and must be quoted.
The following should work
management:
endpoint:
shutdown:
enabled: true
endpoints:
web:
exposure:
include: "*"
Upvotes: 4
Reputation: 171
That may be, because of Spring/Actuator version, that you are using, Endpoints have changed quite a bit in Spring Boot 2.0 and, as a result, your configuration is out of date. Try next:
management.endpoints.web.expose=*
management.endpoint.shutdown.enabled=true
OR
management.endpoints.web.exposure.include=shutdown
management.endpoint.shutdown.enabled=true
You can check more about changes in Spring Boot 2.0 in release notes.
Upvotes: 3