【问题标题】:Is there a way to disable ReactiveHealthIndicators in Spring Boot 2 Actuator?有没有办法在 Spring Boot 2 Actuator 中禁用 ReactiveHealthIndicators?
【发布时间】:2019-04-03 20:14:38
【问题描述】:

使用 Spring Boot 2.1.2 执行器。我的类路径中有 Redis。 Actuator 自动启用 RedisReactiveHealthIndicator。我不想要那个。我的应用程序不是反应式的。我想要 RedisHealthIndicator,但响应式正在替换它。

有没有办法停止自动启用反应性健康指标?

【问题讨论】:

  • 我很困惑,因为我在文档中找不到任何关于如何仅禁用反应指标的内容。

标签: spring-boot spring-boot-actuator


【解决方案1】:
management.health.redis.enabled = false

将此添加到您的 application.properties 文件中。

希望这会有所帮助;)

【讨论】:

  • 不,抱歉,我不想禁用它,我只是不想要反应式运行状况指示器
  • 这不一样吗?
  • 没有。我希望 RedisHealthIndicator 运行,但不是 RedisReactiveHealthIndicator。反应式指示器在我的环境中无法正常工作,但它正在取代我的一个应用程序中的标准指示器。我无法弄清楚为什么反应式运行一个应用程序而标准运行另一个应用程序。我查看了执行器源代码,如果 Flux 类在类路径中,则似乎反应性的运行而不是标准的运行。但是,Flux 在我的两个应用程序的类路径中——我尝试排除 Reactor 但这会导致启动时出错
  • 请发布您的 pom 或 gradle.build 文件。
【解决方案2】:

不如试试这个

@EnableAutoConfiguration(exclude={RedisReactiveHealthIndicator.class})

【讨论】:

  • 导致:java.lang.IllegalStateException:无法排除以下类,因为它们不是自动配置类:-org.springframework.boot.actuate.redis.RedisReactiveHealthIndicator
猜你喜欢
  • 1970-01-01
  • 2016-06-19
  • 2019-02-08
  • 1970-01-01
  • 2016-03-27
  • 2018-04-02
  • 2016-05-03
  • 1970-01-01
  • 2021-12-14
相关资源
最近更新 更多