我正actuator/shutdown
按照本教程中的说明,尝试在Spring应用程序中添加一个关闭端点,以便可以使用像这样的调用正常关闭该应用程序curl -X POST localhost:8080/actuator/shutdown
。
我加了
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
给我pom.xml
和
management:
endpoints.web.exposure.include: *
endpoint.shutdown.enabled: true
endpoints.shutdown.enabled: true
management.endpoint.shutdown.enabled: true
到src/main/resources/application.yaml
。
但是当我运行时curl -X POST localhost:8080/actuator/shutdown
,我得到以下响应:
{"timestamp":"2020-04-10T10:49:36.758+0000","status":404,"error":"Not Found",
"message":"No message available","path":"/actuator/shutdown"}
我在没看到关机端点http://localhost:8080/actuator
:
我究竟做错了什么?为了使actuator/shutdown
端点出现,我需要更改什么?
看来你使用的是yaml,*
在yaml中有特殊含义,必须加引号。
以下应该工作
management:
endpoint:
shutdown:
enabled: true
endpoints:
web:
exposure:
include: "*"