For the latest stable version, please use Spring Boot 3.4.0!spring-doc.cn

NoSQL

Spring Boot offers a number of starters that support NoSQL technologies. This section answers questions that arise from using NoSQL with Spring Boot.spring-doc.cn

Use Jedis Instead of Lettuce

By default, the Spring Boot starter (spring-boot-starter-data-redis) uses Lettuce. You need to exclude that dependency and include the Jedis one instead. Spring Boot manages both of these dependencies, allowing you to switch to Jedis without specifying a version.spring-doc.cn

The following example shows how to accomplish this in Maven:spring-doc.cn

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-data-redis</artifactId>
	<exclusions>
		<exclusion>
			<groupId>io.lettuce</groupId>
			<artifactId>lettuce-core</artifactId>
		</exclusion>
	</exclusions>
</dependency>
<dependency>
	<groupId>redis.clients</groupId>
	<artifactId>jedis</artifactId>
</dependency>

The following example shows how to accomplish this in Gradle:spring-doc.cn

dependencies {
	implementation('org.springframework.boot:spring-boot-starter-data-redis') {
	    exclude group: 'io.lettuce', module: 'lettuce-core'
	}
	implementation 'redis.clients:jedis'
	// ...
}