我們在引入依賴之后,訪問相關接口依然不生效的解決方法
1.默認配置
首先不了解Actuator的各個接口的可以查看官網(wǎng)學習:https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html#production-ready-endpoints
首先Actuator提供了很多的接口:
但是默認打開的就幾個樱溉,其他的接口都是需要手動打開的:
官網(wǎng)說除了默認打開的轩缤,想要開啟需要做配置:
management.endpoint.shutdown.enabled=true
比如我想打開beans的接口:
management.endpoint.beans.enabled=true
如果想要默認都關閉,然后部分自己定義的打開,可以這么做:
management.endpoints.enabled-by-default=false
management.endpoint.info.enabled=true
1. 2.0之后即使配置打開,接口也無法訪問解決
在配置文件中配置
management.endpoints.web.exposure.include=*