Spring Boot 执行器的 /beans 不可访问

Nil*_*pal 4 java spring spring-boot spring-boot-actuator spring-micrometer

尝试使用具有执行器依赖项的简单 Spring Boot 应用程序,但无法访问http://localhost:8080/actuator/beans

\n\n

我可以使用以下输出访问http://localhost:8080/actuator :

\n\n
{"_links":{"self":{"href":"http://localhost:8080/actuator","templated":false},"health-component-instance":{"href":"http://localhost:8080/actuator/health/{component}/{instance}","templated":true},"health-component":{"href":"http://localhost:8080/actuator/health/{component}","templated":true},"health":{"href":"http://localhost:8080/actuator/health","templated":false},"info":{"href":"http://localhost:8080/actuator/info","templated":false}}}\n
Run Code Online (Sandbox Code Playgroud)\n\n

另外,主要无法访问此处列出的以下网址

\n\n
/auditevents \xe2\x80\x93 lists security audit-related events such as user login/logout. Also, we can filter by principal or type among others fields\n/beans \xe2\x80\x93 returns all available beans in our BeanFactory. Unlike \n/auditevents, it doesn\xe2\x80\x99t support filtering\n/conditions \xe2\x80\x93 formerly known as /autoconfig, builds a report of conditions around auto-configuration\n/configprops \xe2\x80\x93 allows us to fetch all @ConfigurationProperties beans\n/env \xe2\x80\x93 returns the current environment properties. Additionally, we can retrieve single properties\n/flyway \xe2\x80\x93 provides details about our Flyway database migrations\n/health \xe2\x80\x93 summarises the health status of our application\n/heapdump \xe2\x80\x93 builds and returns a heap dump from the JVM used by our application\n/info \xe2\x80\x93 returns general information. It might be custom data, build information or details about the latest commit\n/liquibase \xe2\x80\x93 behaves like /flyway but for Liquibase\n/logfile \xe2\x80\x93 returns ordinary application logs\n/loggers \xe2\x80\x93 enables us to query and modify the logging level of our application\n/metrics \xe2\x80\x93 details metrics of our application. This might include generic metrics as well as custom ones\n /prometheus \xe2\x80\x93 returns metrics like the previous one, but formatted to work with a Prometheus server\n/scheduledtasks \xe2\x80\x93 provides details about every scheduled task within our application\n/sessions \xe2\x80\x93 lists HTTP sessions given we are using Spring Session\n/shutdown \xe2\x80\x93 performs a graceful shutdown of the application\n/threaddump \xe2\x80\x93 dumps the thread information of the underlying JVM\n
Run Code Online (Sandbox Code Playgroud)\n

Pat*_*mil 8

Default management.endpoints.web.exposure.include, info, health
Asactuator/healthactuator/info是默认提供的。这样你就能得到信息

management.endpoints.web.exposure.include = * //将允许公开所有端点

management.endpoints.web.exposure.include=health,info # Endpoint IDs that should be included or '*' for all.
management.endpoints.web.exposure.exclude= # Endpoint IDs that should be excluded or '*' for all.
management.endpoints.web.base-path=/actuator # Base path for Web endpoints. Relative to server.servlet.context-path or management.server.servlet.context-path if management.server.port is configured.
management.endpoints.web.path-mapping= # Mapping between endpoint IDs and the path that should expose them.
Run Code Online (Sandbox Code Playgroud)

保护端点

management.endpoint.health.roles= # Roles used to determine whether or not a user is authorized to be shown details. When empty, all authenticated users are authorized. //for health

management.endpoint.health.show-details=always,never # When to show full health details.
Run Code Online (Sandbox Code Playgroud)

启用/禁用端点

management.endpoint.(endpointName).enabled=true # Whether to enable the health endpoint.
e.g. management.endpoint.health.enabled=true
Run Code Online (Sandbox Code Playgroud)

手动配置请参考

请参阅了解更多详细信息