Skip to content

Redis health indicator autoconfiguration is not correct #27322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jorgerod opened this issue Jul 14, 2021 · 1 comment
Closed

Redis health indicator autoconfiguration is not correct #27322

jorgerod opened this issue Jul 14, 2021 · 1 comment
Labels
status: duplicate A duplicate of another issue

Comments

@jorgerod
Copy link

I use spring-boot 2.5.2 and I think that Redis health indicator autoconfiguration is not correct.

org.springframework.boot.actuate.autoconfigure.redis.RedisReactiveHealthContributorAutoConfiguration has this condition: @ConditionalOnClass({ ReactiveRedisConnectionFactory.class, Flux.class })
and I think that is incorrect because an application can be blocking and have in the classpath the Flux class. An application is reactive if use a webflux server.

For example, in my case, I use spring-boot-starter-data-redis (version 2.5.2) and transitively it is using lettuce which in turn brings reactor-core.
Therefore, the condition will always be matched and the two autoconfigurations (org.springframework.boot.actuate.autoconfigure.redis.RedisReactiveHealthContributorAutoConfiguration and org.springframework.boot.actuate.autoconfigure.redis.RedisHealthContributorAutoConfiguration) will be loaded.

I think it could be solved by adding the condition @ConditionalOnWebApplication(type=REACTIVE) for reactive autoconfiguration and @ConditionalOnWebApplication(type=SERVLET) for blocking autoconfiguration.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 14, 2021
@snicoll
Copy link
Member

snicoll commented Jul 14, 2021

@jorgerod thanks for the report, we're aware of the limitation. There's nothing wrong with the current state as the reactive health indicator variant is going to work just fine in your "non-reactive" app.

Duplicate of #22692

@snicoll snicoll closed this as completed Jul 14, 2021
@snicoll snicoll added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants