作用:
提供对springboot工作情况的监视作用,每一项指标称之为一个endpoint
配置方式:
在pom中
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
此时,可以使用 /actuator/endpoint的方式,对各项指标进行监控,但默认只开放了info和health.
开放更多的endpoint
可以在application.yml中加以配置
management:
endpoints:
web:
exposure:
include: '*'
工作原理:
Health endpoint的工作原理
是扫描项目中的AbstractHealthIndicator
类,根据其doHealthCheck()
方法的返回结果,决定最终的显示结果。