Commit 9f998d61 authored by Stephane Nicoll's avatar Stephane Nicoll

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
parent 0389fbae
...@@ -3029,13 +3029,12 @@ normal in a Spring Boot application (you normally only have one application cont ...@@ -3029,13 +3029,12 @@ normal in a Spring Boot application (you normally only have one application cont
[[howto-use-lettuce-instead-of-jedis]] [[howto-use-jedis-instead-of-lettuce]]
=== Use Lettuce instead of Jedis === Use Jedis instead of Lettuce
The Spring Boot starter (`spring-boot-starter-data-redis`) uses The Spring Boot starter (`spring-boot-starter-data-redis`) uses
https://github.com/xetorthio/jedis/[Jedis] by default. You need to exclude that dependency https://github.com/lettuce-io/lettuce-core/[Lettuce] by default. You need to exclude that
and include the https://github.com/lettuce-io/lettuce-core/[Lettuce] one instead. You also dependency and include the https://github.com/xetorthio/jedis/[Jedis] one instead. Spring
need `commons-pool2`. Spring Boot manages these dependencies to help make this process as Boot manages these dependencies to help make this process as easy as possible.
easy as possible.
Example in Maven: Example in Maven:
...@@ -3046,18 +3045,14 @@ Example in Maven: ...@@ -3046,18 +3045,14 @@ Example in Maven:
<artifactId>spring-boot-starter-data-redis</artifactId> <artifactId>spring-boot-starter-data-redis</artifactId>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.lettuce</groupId> <groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId> <artifactId>lettuce-core</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>redis.clients</groupId>
<artifactId>commons-pool2</artifactId> <artifactId>jedis</artifactId>
</dependency> </dependency>
---- ----
...@@ -3066,12 +3061,11 @@ Example in Gradle: ...@@ -3066,12 +3061,11 @@ Example in Gradle:
[source,groovy,indent=0,subs="verbatim,quotes,attributes"] [source,groovy,indent=0,subs="verbatim,quotes,attributes"]
---- ----
configurations { configurations {
compile.exclude module: "jedis" compile.exclude module: "lettuce"
} }
dependencies { dependencies {
compile("io.lettuce:lettuce-core") compile("redis.clients:jedis")
compile("org.apache.commons:commons-pool2")
// ... // ...
} }
---- ----
...@@ -3352,14 +3352,13 @@ http://projects.spring.io/spring-data[projects.spring.io/spring-data]. ...@@ -3352,14 +3352,13 @@ http://projects.spring.io/spring-data[projects.spring.io/spring-data].
=== Redis === Redis
http://redis.io/[Redis] is a cache, message broker and richly-featured key-value store. http://redis.io/[Redis] is a cache, message broker and richly-featured key-value store.
Spring Boot offers basic auto-configuration for the Spring Boot offers basic auto-configuration for the
https://github.com/xetorthio/jedis/[Jedis] and https://github.com/mp911de/lettuce/[Lettuce] https://github.com/lettuce-io/lettuce-core/[Lettuce] and
client library and abstractions on top of it provided by https://github.com/xetorthio/jedis/[Jedis] client library and abstractions on top of it
https://github.com/spring-projects/spring-data-redis[Spring Data Redis]. 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 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 a convenient way that uses https://github.com/lettuce-io/lettuce-core/[Lettuce] by
are building a reactive application, the `spring-boot-starter-data-redis-reactive` default. Both traditional and regular applications are handled by that starter.
'`Starter`' will get you going.
...@@ -3387,8 +3386,8 @@ instance will attempt to connect to a Redis server using `localhost:6379`: ...@@ -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 TIP: You can also register an arbitrary number of beans implementing
`JedisClientConfigurationBuilderCustomizer` for more advanced customizations. If you are `LettuceClientConfigurationBuilderCustomizer` for more advanced customizations. If you are
using Lettuce, `LettuceClientConfigurationBuilderCustomizer` is also available. 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 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 default (except in the case of `RedisTemplate` the exclusion is based on the bean name
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
<module>spring-boot-starter-data-mongodb-reactive</module> <module>spring-boot-starter-data-mongodb-reactive</module>
<module>spring-boot-starter-data-neo4j</module> <module>spring-boot-starter-data-neo4j</module>
<module>spring-boot-starter-data-redis</module> <module>spring-boot-starter-data-redis</module>
<module>spring-boot-starter-data-redis-reactive</module>
<module>spring-boot-starter-data-rest</module> <module>spring-boot-starter-data-rest</module>
<module>spring-boot-starter-data-solr</module> <module>spring-boot-starter-data-solr</module>
<module>spring-boot-starter-freemarker</module> <module>spring-boot-starter-freemarker</module>
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starters</artifactId>
<version>2.0.0.BUILD-SNAPSHOT</version>
</parent>
<artifactId>spring-boot-starter-data-redis-reactive</artifactId>
<name>Spring Boot Data Redis Reactive Starter</name>
<description>Starter for using Redis key-value data store with Spring Data Redis
reactive and the Lettuce client</description>
<url>http://projects.spring.io/spring-boot/</url>
<organization>
<name>Pivotal Software, Inc.</name>
<url>http://www.spring.io</url>
</organization>
<properties>
<main.basedir>${basedir}/../..</main.basedir>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.basepom.maven</groupId>
<artifactId>duplicate-finder-maven-plugin</artifactId>
<executions>
<execution>
<id>duplicate-dependencies</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<ignoredResourcePatterns>
<ignoredResourcePattern>changelog.txt</ignoredResourcePattern>
</ignoredResourcePatterns>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<artifactId>spring-boot-starter-data-redis</artifactId> <artifactId>spring-boot-starter-data-redis</artifactId>
<name>Spring Boot Data Redis Starter</name> <name>Spring Boot Data Redis Starter</name>
<description>Starter for using Redis key-value data store with Spring Data Redis and <description>Starter for using Redis key-value data store with Spring Data Redis and
the Jedis client</description> the Lettuce client</description>
<url>http://projects.spring.io/spring-boot/</url> <url>http://projects.spring.io/spring-boot/</url>
<organization> <organization>
<name>Pivotal Software, Inc.</name> <name>Pivotal Software, Inc.</name>
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>redis.clients</groupId> <groupId>io.lettuce</groupId>
<artifactId>jedis</artifactId> <artifactId>lettuce-core</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
......
provides: spring-data-redis,jedis provides: spring-data-redis,lettuce-core
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment