1、springboot1.5健康检查
在 pom 文件中添加 Actuator 的坐标
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
因为默认的访问安全限制是开启的,所以,没法获取其检查信息,因此需要先关闭安全限制。
在application.properties全局配置文件中加入如下配置,配置后所有的endpoint都打开了
management.security.enabled=false
启动程序在控制台看到如下信息
如果只想用health健康检查
endpoints.enabled=false
endpoints.health.enabled = true
访问 http://127.0.0.1:端口/health
2、springboot2.0健康检查
通过下面的配置启用所有的监控端点,默认情况下