Spring boot spring-boot-starter-actuator监控插件中 端口访问404问题
1.项目中使用的maven插件对依赖包进行管理,在pom文件中需要添加配置,用来加载配置<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</art...
·
1.项目中使用的maven插件对依赖包进行管理,在pom文件中需要添加配置,用来加载配置
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
2.导致借口访问失败的原因
spring-boot 1.0 版本能够正常访问
spring-boot 2.0 版本当中,作为安全性考虑,将actuator 控件中的端口,只默认开放/health 和/info 两个端口,其他端口默认关闭。当你需要使用气短监控端口时,需要手动在application.properties 文件中添加配置。配置形式为 management.endpoints.web.exposure.include=xxx 开启xxx端口的访问 , 如果去掉所有的端口访问限制,则配置形式为
management.endpoints.web.exposure.include=*
management.endpoints.web.exposure.include=env
management.endpoints.web.exposure.include=*
2.0以上版本中,除了提供了开启某个端口的访问配置之外,还提供了关闭某个端口到的访问配置形式为
management.endpoints.web.exposure.exclude=xxx,xxx
management.endpoints.web.exposure.exclude=env,beans
2.0中还有一个变动,所有的端口 默认访问形式都是 actuator/XXX 例如actuator/health。
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐

所有评论(0)