【发布时间】:2021-10-15 00:58:31
【问题描述】:
我想创建一个自定义端点,它会提供一些自定义信息。我知道有两种方法可以实现:HealthIndicator 和@Endpoint。 但是我想把我的端点放在另一个路径而不是默认的 /health/xxx 下,此外,从默认 /health 端点返回的原始健康信息也包含在我的自定义端点中。这种特殊情况我该怎么办?欣赏它。
【问题讨论】:
-
为什么不使用
@RestController来实现自己的端点?您需要的自定义数据检索将来自HealthIndicator接口实现。 -
/actuator/ 端点一旦包含就应该在那里,或者您只想将 /actuator/health 重定向到 /health?
-
@Ferimi-4 谢谢。你的意思是我点击 /actuator/health 并手动检索它的响应?
-
@BookOfZeus 谢谢。我的意思是我想创建一个像 /actuator/myCustomHealth 这样的新端点,而不是将它直接放在 /actuator/health/myCustomHealth 这样的默认 /health 路径下。但我还需要在我的新端点中包含从默认 /actuator/health 返回的所有数据
标签: spring-boot spring-boot-actuator health-check