Currently spring-boot-starter-data-redis
pulls in Jedis while newly introduced spring-boot-starter-data-redis-reactive
pulls in Lettuce as Redis driver.
Since Lettuce is preferred choice for many and now has first-class support in Boot, perhaps the driver choice in spring-boot-starter-data-redis
could be reconsidered for Boot 2.0.
Comment From: mp911de
Lettuce has been the default client for quite a while until in 2014 Lettuce was no longer maintained. Jedis became the defacto standard client for Java applications see (#745).
Adoption of the new Lettuce fork was introduced in Spring Data Redis about two years ago and in Spring Boot only recently (with 2.0 M1). Changing the default client library impacts quite a few things so a change can cause issues for existing users. Jedis is supported for over three years, so all former sharp corners are quite polished by now.
As far as I understood the Boot team, it's not entirely opposed to the change. They want to collect some feedback from using Lettuce with the reactive starter for a later decision. Also, Spring Data needs to polish up pooling support for Lettuce.
Right now, Spring Boot defaults to Lettuce, if you have both drivers on the classpath.
Comment From: snicoll
Thanks @mp911de - I agree with that analysis. We can reconsider this later.
Comment From: ahmetgeymen
@mp911de
Right now, Spring Boot defaults to Lettuce, if you have both drivers on the classpath.
Hello, how can we see this preference, can you share any code link on GitHub for this distinction.
Comment From: wilkinsona
@ahmetgeymen It's determined by the import ordering in RedisAutoConfiguration
:
https://github.com/spring-projects/spring-boot/blob/a03426af571416d7907cd60f0385448f0a191e0f/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfiguration.java#L50
Comment From: ahmetgeymen
@wilkinsona Thanks for the answer, I've seen this line but when it imports both configuration class I couldn't understand where the exact decision made. During migration from Spring Boot from 1.5 to 2.0 it is stated that Lettuce is the default driver.
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Migration-Guide#redis
I'm a bit obsessed with finding the exact line or the explanation how it choose Lettuce instead Jedis.
Thanks again.
Comment From: wilkinsona
LettuceConnectionConfiguration
will define a RedisConnectionFactory
bean:
https://github.com/spring-projects/spring-boot/blob/23c5549832fcd2ecad82fbadd974e2d9eed043b3/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/LettuceConnectionConfiguration.java#L69-L77
This bean's definition that causes JedisConnectionConfiguration
to back off as it's definition of a RedisConnectionFactory
bean is conditional on such a bean being missing:
https://github.com/spring-projects/spring-boot/blob/23c5549832fcd2ecad82fbadd974e2d9eed043b3/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/JedisConnectionConfiguration.java#L56-L61
If you have any further questions, please follow up on Stack Overflow or Gitter. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.