Switch redis starter to use Lettuce
This commit changes the default client to Lettuce. This has the side effect of making the `spring-boot-starter-redis-reactive` irrelevant. Recent improvements made pooling optional so `commons-pool2` is no longer provided by default either. Closes gh-10480
This commit is contained in:
@@ -3029,13 +3029,12 @@ normal in a Spring Boot application (you normally only have one application cont
|
||||
|
||||
|
||||
|
||||
[[howto-use-lettuce-instead-of-jedis]]
|
||||
=== Use Lettuce instead of Jedis
|
||||
[[howto-use-jedis-instead-of-lettuce]]
|
||||
=== Use Jedis instead of Lettuce
|
||||
The Spring Boot starter (`spring-boot-starter-data-redis`) uses
|
||||
https://github.com/xetorthio/jedis/[Jedis] by default. You need to exclude that dependency
|
||||
and include the https://github.com/lettuce-io/lettuce-core/[Lettuce] one instead. You also
|
||||
need `commons-pool2`. Spring Boot manages these dependencies to help make this process as
|
||||
easy as possible.
|
||||
https://github.com/lettuce-io/lettuce-core/[Lettuce] by default. You need to exclude that
|
||||
dependency and include the https://github.com/xetorthio/jedis/[Jedis] one instead. Spring
|
||||
Boot manages these dependencies to help make this process as easy as possible.
|
||||
|
||||
Example in Maven:
|
||||
|
||||
@@ -3046,18 +3045,14 @@ Example in Maven:
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<groupId>io.lettuce</groupId>
|
||||
<artifactId>lettuce-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.lettuce</groupId>
|
||||
<artifactId>lettuce-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
</dependency>
|
||||
----
|
||||
|
||||
@@ -3066,12 +3061,11 @@ Example in Gradle:
|
||||
[source,groovy,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
configurations {
|
||||
compile.exclude module: "jedis"
|
||||
compile.exclude module: "lettuce"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile("io.lettuce:lettuce-core")
|
||||
compile("org.apache.commons:commons-pool2")
|
||||
compile("redis.clients:jedis")
|
||||
// ...
|
||||
}
|
||||
----
|
||||
|
||||
@@ -3352,14 +3352,13 @@ http://projects.spring.io/spring-data[projects.spring.io/spring-data].
|
||||
=== Redis
|
||||
http://redis.io/[Redis] is a cache, message broker and richly-featured key-value store.
|
||||
Spring Boot offers basic auto-configuration for the
|
||||
https://github.com/xetorthio/jedis/[Jedis] and https://github.com/mp911de/lettuce/[Lettuce]
|
||||
client library and abstractions on top of it provided by
|
||||
https://github.com/spring-projects/spring-data-redis[Spring Data Redis].
|
||||
https://github.com/lettuce-io/lettuce-core/[Lettuce] and
|
||||
https://github.com/xetorthio/jedis/[Jedis] client library and abstractions on top of it
|
||||
provided by https://github.com/spring-projects/spring-data-redis[Spring Data Redis].
|
||||
|
||||
There is a `spring-boot-starter-data-redis` '`Starter`' for collecting the dependencies in
|
||||
a convenient way that uses https://github.com/xetorthio/jedis/[Jedis] by default. If you
|
||||
are building a reactive application, the `spring-boot-starter-data-redis-reactive`
|
||||
'`Starter`' will get you going.
|
||||
a convenient way that uses https://github.com/lettuce-io/lettuce-core/[Lettuce] by
|
||||
default. Both traditional and regular applications are handled by that starter.
|
||||
|
||||
|
||||
|
||||
@@ -3387,8 +3386,8 @@ instance will attempt to connect to a Redis server using `localhost:6379`:
|
||||
----
|
||||
|
||||
TIP: You can also register an arbitrary number of beans implementing
|
||||
`JedisClientConfigurationBuilderCustomizer` for more advanced customizations. If you are
|
||||
using Lettuce, `LettuceClientConfigurationBuilderCustomizer` is also available.
|
||||
`LettuceClientConfigurationBuilderCustomizer` for more advanced customizations. If you are
|
||||
using Jedis, `JedisClientConfigurationBuilderCustomizer` is also available.
|
||||
|
||||
If you add a `@Bean` of your own of any of the auto-configured types it will replace the
|
||||
default (except in the case of `RedisTemplate` the exclusion is based on the bean name
|
||||
|
||||
Reference in New Issue
Block a user