想要在spring boot 项目中,使用spring-boot-starter-actuator监控插件,对各种参数进行监控时,发现除了/health和/info 端口之外,其他的端口访问都为404 。
1.项目中使用的maven插件对依赖包进行管理,在pom文件中需要添加配置,用来加载配置
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId

在Spring Boot项目中,使用spring-boot-starter-actuator遇到除/health和/info外的端口404问题。原因是Spring Boot 2.0及以上版本出于安全考虑,默认只开放这两个端口。解决方法是在application.properties中添加配置,如`management.endpoints.web.exposure.include=xxx`来开启特定端口,或`management.endpoints.web.exposure.include=*`开放所有端口。此外,2.0版本起,所有端口访问前缀为`actuator/XXX`。详细信息可参考官方文档或中文翻译。
最低0.47元/天 解锁文章
2053

被折叠的 条评论
为什么被折叠?



