Closed YiiGaa closed 4 months ago
I'm afraid that we don't consider this to be a bug. There are many places in Spring Boot where we inject a …Properties
class and expect there to be a single candidate. We also don't consider the …Properties
classes to be public API:
The properties that map to
@ConfigurationProperties
classes available in Spring Boot, which are configured through properties files, YAML files, environment variables, and other mechanisms, are public API but the accessors (getters/setters) of the class itself are not meant to be used directly.
You should define your own @ConfigurationProperties
class that meets your specific needs.
We hope to improve support for auto-configuring multiple beans, such as multiple Redis connections in the future. Please see #22403 and #15732 for details.
Springboot version: 3.3.1
I want to connect multiple redis on springboot, and I have defined a custom prefix for creating my own LettuceConnectionFactory :
But when running springboot, there is an error.
The reason is that
org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration
automatically usesRedisProperties
.And the
spring.data.redis-org.springframework.boot.autoconfigure.data.redis.RedisProperties
defined like this:I think
spring.data.redis-org.springframework.boot.autoconfigure.data.redis.RedisProperties
should add@Primary
or LettuceConnectionConfiguration change the setting of
@ConditionalOnProperty
or LettuceConnectionConfiguration add @Qualifier for RedisProperties properties