[英]How can I disable the refreshScope health indicator in spring boot + cloud?
使用:
management.health.refresh.enabled=false
您需要创建一个RefreshScopeHealthIndicator
bean 并覆盖doHealthCheck
方法以不抛出异常。 代码片段是 Kotlin,但你会明白的。
@Component
class CustomHealthIndicator(
private val scope: ObjectProvider<RefreshScope>,
private val rebinder: ConfigurationPropertiesRebinder
): RefreshScopeHealthIndicator(scope, rebinder) {
override fun doHealthCheck(builder: Health.Builder) {
builder.up()
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.