依赖

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

在 application.properties 中添加如下配置:

management.endpoint.health.probes.enabled=true

访问:

/actuator/health/liveness 和 /actuator/health/readiness

参考:https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html#actuator.enabling
参考:https://www.hangge.com/blog/cache/detail_2705.html
参考:https://www.jianshu.com/p/8aa4ae9be025