【发布时间】:2018-12-04 13:56:17
【问题描述】:
我有一个打包为.war 文件并在wildfly 实例上运行的spring boot 应用程序。
我刚刚在我的 pom 文件中添加了 micrometer 和 actuator 依赖项:
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
当我将应用程序部署到 Wildfly 并且它启动并运行时,我可以访问默认端点 /info 和 /health,而以下网址没有任何问题:
http://localhost:8080/myApp/info
http://localhost:8080/myApp/health
但无论我做什么,我都无法访问/actuator 或任何其他端点。
我目前正在使用将自定义属性映射到我的应用程序中的 Config 类的外部配置文件。该配置文件还包含未映射到配置类的 Spring Boot 属性:
###################################################################
# Spring Boot properties
###################################################################
spring.http.multipart.max-file-size=500Mb
spring.http.multipart.max-request-size=500Mb
logging.level.org.springframework.web=DEBUG
logging.level.org.springframework.web.filter.CommonsRequestLoggingFilter=DEBUG
server.error.whitelabel.enabled=false
这些参数由 spring boot 拾取,没有任何问题。
我还在同一个文件中添加了以下执行器属性:
###################################################################
# Actuator Properties
###################################################################
management.endpoints.web.exposure.include=*
management.endpoint.prometheus.enabled=true
management.endpoint.metrics.enabled=true
management.endpoint.status.enabled=true
management.endpoint.prometheus.show-details=always
management.endpoint.metrics.show-details=always
management.endpoint.status.show-details=always
management.endpoint.health.show-details=always
这些属性没有区别,我只能访问 /info 和 /health
我错过了什么?
编辑:此应用程序中目前没有安全模块。
【问题讨论】:
-
尝试添加以下属性,endpoints.enabled=true endpoints.sensitive=false
-
如果您打开执行器的跟踪级别日志记录,您是否看到任何已注册的端点? logging.level.org.springframework.boot.actuate=trace
-
尝试删除所有执行器属性,除了 management.endpoints.web.exposure.include=*
-
你为什么通过localhost:8080/myApp/info而不是localhost:8080/actuator/info访问这些端点?
-
请指定spring-boot/actuator/micrometer的版本。
标签: java spring-boot properties-file spring-boot-actuator spring-micrometer