pom.xml
<!-- Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
application.properties配置文件:
##安全监控Actuator
##spring boot2默认不启用所有的监控,需要如下配置
endpoints.default.web.enabled = true
##设置安全监控的端口(也可以不与项目本身的端口保持一致)
management.server.port = 8082
##设置管理端点的基本路径,默认值为:actuator,列如:http://localhost:8082/actuator/health
##如下配置的话,就如同:http://localhost:8082/health
management.endpoints.web.base-path=/
##系统健康信息默认是不显示的,需要如下配置
management.endpoint.health.show-details=always
#management.endpoints.web.exposure.exclude=*