Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 332
ieXcept Avatar asked Jan 10 '18 17:01

ieXcept


People also ask

Which command is used to shutdown a Spring Boot application?

Use the static exit() method in the SpringApplication class for closing your spring boot application gracefully.

How do I turn off Spring Boot actuator endpoints?

You can enable or disable an actuator endpoint by setting the property management. endpoint. <id>. enabled to true or false (where id is the identifier for the endpoint).

Can we override actuator in Spring Boot?

Overriding the Actuator base path - Spring Boot Tutorial Well, we do have the option of customizing a base path from actuator to something else such as manage. And to do so, we would go into our properties file and add in additional configuration to change the base path from actuator to manage.


1 Answers

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.

like image 62
Andy Wilkinson Avatar answered Oct 02 '22 17:10

Andy Wilkinson