java - 无法让弹簧启动执行器公开默认端点以外的端点,需要建议
问题描述
我有一个打包为.war
文件并在 Wildfly 实例上运行的 Spring Boot 应用程序。
我最近刚刚将micrometer
andactuator
依赖项添加到我的 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
我错过了什么?
编辑:此应用程序中当前没有安全模块。
解决方案
如果您使用低于 2.0 的 Spring Boot 版本,请尝试通过在属性文件中使用 management.security.enabled= false 来禁用安全性
推荐阅读
- javascript - 在 VSCode 中使用 Babylon.js 和 Vue.js 时的自动完成功能(无打字稿)
- flutter - 如何在颤振项目中安装所有缺少的包?
- php - 未定义的常量“page_link”(视图:\resources\views\home\index.blade.php) 在:“\resources\views/home/index.blade.php”文件的第 19 行
- sql - SQL CREATE FUNCTION 生成“没有这样的函数”错误
- javascript - 我的等待代码不会等待我的代码继续
- javascript - 有没有办法在没有文档的情况下找到哪些 API 参数有效?
- javascript - 创建钩子时出错(Promise/async):“TypeError:无法读取未定义的属性‘位置’”
- gremlin - gremlin 查询在控制台中有效,但在 javascript 中无效
- asp.net-core - Asp.Net Core 3.1 Web App(Razor Pages)SignalR - OnChange 事件在 SqlDependency 上多次命中,对于单个客户端
- python - 硒中的按钮不可点击,没有错误消息