SpringBoot自带监控功能Actuator,可以帮助实现对程序内部运行情况监控,比如监控状况、Bean加载情况、配置属性、日志信息等。
加入依赖
spring-boot-starter-actuator
启动项目用,访问网址:
localhost:8080/actuator
监控健康相关直接访问http://localhost:8080/actuator/health:
开启完整的健康检测信息:
# 开启完整的健康检测信息
management.endpoint.health.show-details=always
健康检测还可以检测引入的第三方组件,比如说redis:
我们引redis的坐标,然后重启服务器
spring-boot-starter-data-redis
# 开启完整的健康检测信息
management.endpoint.health.show-details=always
# 将所有的监控endpoint暴露出来
management.endpoints.web.exposure.include=*



