执行器暴露端点不工作

Actuator Exposing Endpoints not working

我正在使用 spring boot 2.0.4 并且想公开我的执行器端点。将以下内容添加到 application.yml 时,只有 info,health 会被暴露。

management:
  endpoints:
    web:
      exposure:
        include: "*"

当我运行http://localhost:8080/actuator我得到

{"_links":{"self":{"href":"http://localhost:8080/actuator","templated":false},"health":{"href":"http://localhost:8080/actuator/health","templated":false},"info":{"href":"http://localhost:8080/actuator/info","templated":false}}}

Spring Boot 2.0 采用略有不同的方法来确保 Web 端点的安全。现在默认禁用大多数 Web 端点(仅公开 /health 和 /info 端点)并且 management.security.enabled 属性 已被删除。 Actuator 不再有单独的安全自动配置,各个端点可能 enabled/disabled and/or 通过 application.properties 文件中的配置公开。例如:

# disable beans endpoint  
management.endpoints.beans.enabled=false  
# expose all endpoints:
management.endpoints.web.exposure.include=*  

查看更多信息 Spring 官方文档:https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Migration-Guide#endpoints