繁体   English   中英

如何在 spring boot + cloud 中禁用 refreshScope 运行状况指示器?

[英]How can I disable the refreshScope health indicator in spring boot + cloud?

我已经使用health.config.enabled=false禁用了配置服务器运行状况指示器,但这并没有禁用 refreshScope 运行状况指示器。

执行器健康检查响应

使用:

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM