【发布时间】:2020-04-10 11:10:57
【问题描述】:
我正在尝试在我的 Spring 应用程序中添加一个关闭端点 actuator/shutdown,如 this tutorial 中所述,以便我可以使用类似 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吗?
标签: java spring spring-boot-actuator