我正在运行Spring应用程序,运行在8080以外的端口上。我需要编写一个rest来检查应用程序和底层数据库的运行情况。
对于同样的问题,我已经浏览了这个帖子:How to add a custom health check in spring boot health?,但是没有找到任何具体的实现。
实际上,我想做以下几点:
有人能帮帮我吗?谢谢。
发布于 2020-06-10 00:54:09
Spring引导执行器可以自动创建公共健康检查(也适用于数据库)和REST。
要开始添加以下依赖项:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
然后,Spring引导将在以下几个执行器端点中公开:
/actuator
对你来说最相关的可能是:
/actuator/health
若要向此端点添加自定义健康检查,您可以按照链接帖子的答案中提供的指南进行操作。
https://stackoverflow.com/questions/62298613
复制相似问题