A simple WebFlux based application consisting of spring-boot-starter-webflux
and spring-boot-starter-data-redis-reactive
dependencies will result in imperative Redis support (namely, RedisTemplate<Object, Object>
and StringRedisTemplate
beans) being auto-configured.
This is because beans auto-configured by RedisAutoConfiguration
(the ones listed earlier) are conditional on presence of imperative RedisConnectionFactory
which is always the case with Lettuce due to LettuceConnectionFactory
implementing both RedisConnectionFactory
and ReactiveRedisConnectionFactory
. This potentially sets up users for failure by configuring components that really shouldn't be available on a non-blocking runtime.
I'm not sure if there are other places where something like this is possible, but similarly like with #15574, it feels like Spring Boot could offer conditions to determine whether the runtime is Servlet or WebFlux based.
Comment From: snicoll
Thanks, we are aware and have been brainstorming about this already, see #22692