Java 为什么我的应用程序中没有启用关机端点?

Java 为什么我的应用程序中没有启用关机端点?,java,spring,spring-boot-actuator,Java,Spring,Spring Boot Actuator,我正试图在我的Spring应用程序中添加一个shutdown端点执行器/shutdown,如中所述,这样我就可以使用curl-X POST localhost:8080/exactor/shutdown这样的调用优雅地关闭应用程序 我补充说 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator

我正试图在我的Spring应用程序中添加一个shutdown端点执行器/shutdown,如中所述,这样我就可以使用curl-X POST localhost:8080/exactor/shutdown这样的调用优雅地关闭应用程序

我补充说

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
到src/main/resources/application.yaml

但是当我运行curl-X POST localhost:8080/exactor/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:


我做错了什么?要使执行器/关闭端点出现,我需要更改什么?

这可能是因为您使用的是Spring/actuator版本,端点在Spring Boot 2.0中发生了相当大的更改,因此,您的配置已过时。 请尝试下一步:

management.endpoints.web.expose=*
management.endpoint.shutdown.enabled=true


您可以在中查看更多有关Spring Boot 2.0中的更改。

可能是因为您使用的Spring/Actuator版本,端点在Spring Boot 2.0中发生了相当大的更改,因此,您的配置已过时。 请尝试下一步:

management.endpoints.web.expose=*
management.endpoint.shutdown.enabled=true


您可以在中查看有关Spring Boot 2.0更改的更多信息。

您似乎正在使用yaml,*在yaml中有特殊含义,必须引用

以下几点应该有效

management:
  endpoint:
    shutdown:
      enabled: true
  endpoints:
    web:
      exposure:
        include: "*"

似乎您正在使用yaml,*在yaml中有特殊含义,必须引用

以下几点应该有效

management:
  endpoint:
    shutdown:
      enabled: true
  endpoints:
    web:
      exposure:
        include: "*"

你在用yaml吗?你在用yaml吗?