Spring-boot: Reactive HealthContributors do not hide non-reactive ones

Created on 25 Oct 2019  路  1Comment  路  Source: spring-projects/spring-boot

Lettuce connection factory, which is both reactive and non-reactive, has two active health indicators when running Boot 2.2.0.

Output of /actuator/health:

{ 
   "status":"UP",
   "components":{ 
      "redis":{ 
         "status":"UP",
         "details":{ 
            "cluster_size":2,
            "slots_up":16384,
            "slots_fail":0
         }
      },
      "redisReactive":{ 
         "status":"UP",
         "details":{ 
            "version":"5.0.5"
         }
      }
   }
}

Only reactive indicator was active in Boot 2.1.

bug

Most helpful comment

@philwebb,
It looks like that bug affects all HealthIndicators, not only Redis.

Previously, @ConditionalOnMissingBean(name="...") was the same for both indicators, now it different.
For this particular case:


    @ConditionalOnMissingBean(name = { "redisHealthIndicator", "redisHealthContributor" })
    public HealthContributor redisHealthContributor(Map<String, RedisConnectionFactory> redisConnectionFactories) {
        return createContributor(redisConnectionFactories);
    }


    @Bean
    @ConditionalOnMissingBean(name = { "redisReactiveHealthIndicator", "redisReactiveHealthContributor" })
    public ReactiveHealthContributor redisReactiveHealthContributor() {
        return createContributor(this.redisConnectionFactories);
    }

}

This commit: f09e0264d9195f6c4dacabe07a51836058092dbf added these changes

>All comments

@philwebb,
It looks like that bug affects all HealthIndicators, not only Redis.

Previously, @ConditionalOnMissingBean(name="...") was the same for both indicators, now it different.
For this particular case:


    @ConditionalOnMissingBean(name = { "redisHealthIndicator", "redisHealthContributor" })
    public HealthContributor redisHealthContributor(Map<String, RedisConnectionFactory> redisConnectionFactories) {
        return createContributor(redisConnectionFactories);
    }


    @Bean
    @ConditionalOnMissingBean(name = { "redisReactiveHealthIndicator", "redisReactiveHealthContributor" })
    public ReactiveHealthContributor redisReactiveHealthContributor() {
        return createContributor(this.redisConnectionFactories);
    }

}

This commit: f09e0264d9195f6c4dacabe07a51836058092dbf added these changes

Was this page helpful?
0 / 5 - 0 ratings