Spring Boot2.0开启Actuator状态监控

Spring Boot的Actuator提供了运行状态监控功能,可以通过REST、远程Shell和JMX方式来查看,使用时在pom文件添加spring-boot-starter-actuator的依赖即可。
配置文件中添加如下内容即可:

management.port=9001
management.security.enabled=false

但在Spring Boot2.0中以上配置选项被废除,而改用如下配置项:

#actuator端口 
management.server.port=9001
#修改访问路径  2.0之前默认是/   2.0默认是 /actuator  可以通过这个属性值修改  
management.endpoints.web.base-path=/monitor
#开放所有页面节点  默认只开启了health、info两个节点
management.endpoints.web.exposure.include=*
#显示健康具体信息  默认不会显示详细信息  
management.endpoint.health.show-details=always

配置完成启动项目后就可以通过postman或者直接在预览器输入路径等方式来查看应用的运行状态了。
例如使用postman发送localhost:9001/monitor/healthGET请求.

猜你喜欢

转载自blog.csdn.net/Loiterer_Y/article/details/83006277