首页 > 解决方案 > 无法让弹簧启动执行器公开默认端点以外的端点,需要建议

问题描述

我有一个打包为.war文件并在 Wildfly 实例上运行的 Spring Boot 应用程序。

我最近刚刚将micrometerandactuator依赖项添加到我的 pom 文件中:

    <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在以下 url 上没有任何问题:

  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  

这些参数由弹簧靴拾取,没有任何问题。
我还在同一个文件中添加了以下执行器属性:

###################################################################
# 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
我错过了什么?

编辑:此应用程序中当前没有安全模块。

标签: javaspring-bootproperties-filespring-boot-actuatorspring-micrometer

解决方案


如果您使用低于 2.0 的 Spring Boot 版本,请尝试通过在属性文件中使用 management.security.enabled= false 来禁用安全性


推荐阅读