将邮件健康指标排除在默认 /执行器 /健康端点中?
我有一个Spring Boot应用程序,该应用程序使用执行器具有/执行器/Health
端点。我最近在应用程序中添加了Spring-boot-starter-sail
,该应用程序自动为邮件服务器添加了健康指示器,因此/cartuator/health
如果邮件服务器将报告下降。
我想从/areatuator/health
本身中删除该健康指标,并拥有另一个端点/coduator/health/sail/mail
以获取完整状态。
我知道我可以通过添加此属性来创建额外的端点:
management.endpoint.health.group.mail.include=mail
但是如何从默认端点删除邮件
?
我尝试使用Management.health.mail.enabled = false
,但是我无法在/cartuator/health/mail
endpoint中使用它。
I have a Spring Boot application that uses the actuator to have a /actuator/health
endpoint. I recently added spring-boot-starter-mail
to the application which automatically adds a health indicator for the mail server so the /actuator/health
will report DOWN if the mail server is down.
I would like to remove that health indicator from /actuator/health
itself and have another endpoint /actuator/health/mail
to get the full status.
I know I can create the extra endpoint by adding this property:
management.endpoint.health.group.mail.include=mail
But how do I remove mail
from the default endpoint?
I tried using management.health.mail.enabled=false
, but then I can't use it in the /actuator/health/mail
endpoint anymore.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这应该有效:
1/创建此健康端点扩展类:
congregateContributions 方法,其名称建议,对每个健康企业进行了汇总。通过覆盖此方法,您可以从汇总结果中删除“邮件”贡献者。
2/在配置类中声明您的自定义组件:
This should works :
1/ Create this Health endpoint extension class :
aggregateContributions method, has its name suggests, does an aggregation of each HealthContributor. By overriding this method you can remove the 'mail' contributor from the aggregated result.
2/ Declare your custom component in a configuration class :
您也可以做
Management.health.mail.enabled = false
。另请注意,执行器/健康/邮件
将返回404,因为它确实已被禁用You can also do
management.health.mail.enabled=false
. Also note thatactuator/health/mail
will return 404 because it has really been disabled