我们正在尝试健康检查弹簧启动应用程序,我们计划使用弹簧启动器执行器健康状况来获取健康状态。
什么是混淆是类提供的默认状态健康检查({ “状态”: “UP”})时CassandraHealthIndicator,DiskSpaceHealthIndicator,DataSourceHealthIndicator,ElasticsearchHealthIndicator, JmsHealthIndicator,MailHealthIndicator,MongoHealthIndicator,RabbitHealthIndicator,RedisHealthIndicator,SolrHealthIndicator是不适用的。
答案 0 :(得分:2)
我认为默认值是ApplicationHealthIndicator,但您当然可以编写自己的:
public class CustomHealthIndicator implements HealthIndicator {
@Override
public Health health() {
int errorCode = check(); // perform some specific health check
if (errorCode != 0) {
return Health.down().withDetail("Error Code", errorCode).build();
}
return Health.up().build();
}
private int check() {
return 0;
}
}
答案 1 :(得分:-1)
在跟踪运行状况请求后找到答案。默认运行状况信息来自DiskSpaceHealthIndicator
,运行状况请求是从HealthMvcEndpoint