【发布时间】:2018-03-28 05:36:08
【问题描述】:
【问题讨论】:
标签: spring spring-boot spring-cloud spring-boot-actuator
【问题讨论】:
标签: spring spring-boot spring-cloud spring-boot-actuator
用途:
management.health.refresh.enabled=false
【讨论】:
您需要创建一个RefreshScopeHealthIndicator 的bean 并覆盖doHealthCheck 方法以不抛出异常。代码 sn-p 是 Kotlin,但你会明白的。
@Component
class CustomHealthIndicator(
private val scope: ObjectProvider<RefreshScope>,
private val rebinder: ConfigurationPropertiesRebinder
): RefreshScopeHealthIndicator(scope, rebinder) {
override fun doHealthCheck(builder: Health.Builder) {
builder.up()
}
}
【讨论】: