<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
这将为您的应用程序添加几个有用的端点.其中之一是/健康.当您启动应用程序并导航到/ health端点时,您将看到它已返回一些数据.
{
"status":"UP",
"diskSpace": {
"status":"UP",
"free":56443746,
"threshold":1345660
}
}
Run Code Online (Sandbox Code Playgroud)
如何在spring boot health中添加自定义运行状况检查?