我试过按照文档,但每次检查时我只看到“status:UP”。我甚至普遍返回Health.down.build(),但我仍然只看到“状态:向上”。我不确定我做错了什么。我没有错。
如果您将HealthIndicator
注释添加到您的班级,您的自定义@Component
将在旅途中注册。如果你然后调用方法执行器/健康,我猜你得到了汇总状态:
{"status":"DOWN"}
只需将其添加到您的application.properties即可查看HealthIndicator
结果的详细视图:
management.endpoint.health.show-details=always
你会得到这样的东西:
{
"status": "DOWN",
"details": {
"MyCustomHealthCheck": {
"status": "DOWN",
"details": {
"remote.system.down": "There is something wrong with system XXX"
}
},
"diskSpace": {
"status": "UP",
"details": {
"total": 499963174912,
"free": 434322321408,
"threshold": 10485760
}
}
}
}