spring-projects / spring-data-redis

Provides support to increase developer productivity in Java when using Redis, a key-value store. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
https://spring.io/projects/spring-data-redis/
Apache License 2.0
1.77k stars 1.17k forks source link

[Lettuce] Externalize ReadFrom configuration into property #3011

Closed thiagoteichmann closed 1 month ago

thiagoteichmann commented 1 month ago

Currently using Lettuce but noticed that config properties lacks readFrom property and require code change to implement it, would be possible to externalize this in a property so we can override the default?

I currently have a redis sentinel totally configured by properties but I cannot configure read from property the same way.

Something like:

spring.redis.lettuce.config.read-from=REPLICA_PREFERRED

or 

spring.redis.config.read-from=REPLICA_PREFERRED
mp911de commented 1 month ago

This is a Spring Boot issue, please file a ticket at https://github.com/spring-projects/spring-boot/issues.

thiagoteichmann commented 1 month ago

Can you clarify why is not a spring data redis issue @mp911de ?

mp911de commented 1 month ago

Because Spring Boot hosts the code to parse config properties and apply these to LettuceConnectionFactory and its config. See https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/LettuceConnectionConfiguration.java

thiagoteichmann commented 1 month ago

Thanks @mp911de !