Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $YECBGYFECGEAFWHA as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2

Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $BBWFDDBHHYHDXXAB as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2
SpringBoot如何拦截所有HealthIndicator的健康检查?_创想鸟

SpringBoot如何拦截所有HealthIndicator的健康检查?

springboot如何拦截所有healthindicator的健康检查?

SpringBoot拦截所有HealthIndicator健康检查方法

为避免健康检查失败导致Kubernetes服务重启,开发者需要拦截所有HealthIndicator调用并记录失败组件。由于HealthIndicator的实现方式,基于执行的切点无法拦截所有调用。

解决方法是使用基于@annotation的切点:

@Around("@annotation(org.springframework.boot.actuate.health.HealthIndicator)")public Object healthIndicatorAdvice(ProceedingJoinPoint pjp) throws Throwable {    // 在此处记录失败的HealthIndicator实现    Object result = pjp.proceed();    // 在此处进一步处理result    return result;}

此方法可拦截所有标注了@HealthIndicator注解的HealthIndicator实现的health()方法。

以上就是SpringBoot如何拦截所有HealthIndicator的健康检查?的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/181675.html

赞 (0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
余承东称华为智驾在行业内断代领先 本月揭晓尊界黑科技
上一篇 2026年9月3日 04:13:36
下一篇 2026年9月3日 04:17:23

相关推荐

发表回复

登录后才能评论
关注微信