@Test public void redisHealthIndicator() { this.context.register(RedisAutoConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, "management.health.diskspace.enabled:false"); this.context.refresh(); Map<String, HealthIndicator> beans = this.context .getBeansOfType(HealthIndicator.class); assertThat(beans).hasSize(1); assertThat(beans.values().iterator().next().getClass()) .isEqualTo(RedisHealthIndicator.class); }
@Test public void redisHealthIndicator() { this.context.register(RedisAutoConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, "management.health.diskspace.enabled:false"); this.context.refresh(); Map<String, HealthIndicator> beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); assertEquals(RedisHealthIndicator.class, beans.values().iterator().next().getClass()); }
@Bean public HealthIndicator binderHealthIndicator(RedisConnectionFactory redisConnectionFactory) { return new RedisHealthIndicator(redisConnectionFactory); }
@Bean @ConditionalOnExpression("#{'${" + FeaturesProperties.FEATURES_PREFIX + "." + FeaturesProperties.ANALYTICS_ENABLED + ":true}'.equalsIgnoreCase('false')}") public RedisHealthIndicator redisHealthIndicator() { return new CustomRedisHealthIndicator(redisConnectionFactory); }