【发布时间】:2018-07-27 09:46:55
【问题描述】:
JHipster / Spring boot 提供了一个很好的端点/management/health,它在其中汇总了 db、disk 和 mail 等子系统的健康信息。
不幸的是,当与邮件服务器的连接失败时,整个端点都会失败。所以你不会得到失败的信息。
我得到这样的轨迹:
o.s.b.a.health.MailHealthIndicator : Health check failed
com.sun.mail.util.MailConnectException: Couldn't connect to host, port: XXXX, NNNN25025; timeout -1
...
at org.springframework.boot.actuate.health.MailHealthIndicator.doHealthCheck(MailHealthIndicator.java:40)
at org.springframework.boot.actuate.health.AbstractHealthIndicator.health(AbstractHealthIndicator.java:43)
at org.springframework.boot.actuate.health.CompositeHealthIndicator.health(CompositeHealthIndicator.java:68)
at org.springframework.boot.actuate.endpoint.HealthEndpoint.invoke(HealthEndpoint.java:85)
at org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.getCurrentHealth(HealthMvcEndpoint.java:177)
at org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.getHealth(HealthMvcEndpoint.java:166)
at org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(HealthMvcEndpoint.java:143)
这是弹簧靴 1.5.9 我应该在哪里解决这个问题,以便捕获异常并返回错误状态?
【问题讨论】:
标签: spring-boot jhipster spring-boot-actuator