执行器暴露端点不起作用 [英] Actuator Exposing Endpoints not working
问题描述
我正在使用 spring boot 2.0.4 并且想要公开我的执行器端点.将以下内容添加到 application.yml 时,只会暴露 info、health.
I am using spring boot 2.0.4 and want to expose my actuator endpoints. When adding the following to application.yml only info, health are being exposed.
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 不再有单独的安全自动配置,可以通过 application.properties 文件中的配置启用/禁用和/或公开各个端点.例如:
Spring Boot 2.0 takes a slightly different approach to ensure web endpoints security. The majority of Web endpoints are now disabled by default (Only the /health and /info endpoints are exposed) and the management.security.enabled property has been removed. There is no longer a separate security auto-configuration for the Actuator, individual endpoints may be enabled/disabled and/or exposed via configuration in the application.properties file. For example:
# 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
See additional info Spring official documentation: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Migration-Guide#endpoints
这篇关于执行器暴露端点不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!