Why Spring Boot 2.0 Switched to Lettuce: Key Features and Benefits

This article explains why Spring Boot 2.0 replaced the Jedis Redis client with Lettuce, highlighting Lettuce’s netty‑based architecture, thread‑safe shared connections, asynchronous and reactive support, seamless Redis Sentinel and Cluster integration, SSL, streaming API, and provides code examples for both blocking and async usage.

Java High-Performance Architecture
Java High-Performance Architecture
Java High-Performance Architecture
Why Spring Boot 2.0 Switched to Lettuce: Key Features and Benefits

1. Introduction

Spring Boot 2.0 changed its Redis client driver from Jedis to Lettuce . This article explores whether the decision is based on preference or technical reasons.

Lettuce offers many excellent features, such as:

Netty‑based, supporting an event model

Supports synchronous, asynchronous, and reactive usage

Easy connection to Redis Sentinel

Full support for Redis Cluster

SSL connections

Streaming API

Integration with CDI and Spring

Compatibility with Java 8 and 9

2. Important Features

(1) Multi‑threaded Sharing

Jedis uses a direct connection mode; sharing a Jedis instance across multiple threads is unsafe, requiring a connection pool for each thread, which increases physical connection costs.

Lettuce, built on Netty, allows a single connection instance to be safely shared among multiple threads, eliminating the need for many connections.

(2) Asynchronous

Asynchronous operation better utilizes system resources by avoiding thread blocking on network or disk I/O.

Because Lettuce relies on Netty, a multithreaded event‑driven I/O framework, it can fully exploit asynchronous advantages.

Code Example

Connection

Blocking read

Set timeout for blocking read

Asynchronous usage with RedisFuture<T> triggers actions when the future completes

(3) Excellent Redis Cluster Support

Lettuce supports all cluster commands, hash‑slot based routing, high‑level abstractions, multi‑node command execution, direct node connections by slot and address, SSL and authentication, topology updates, and publish/subscribe.

(4) Streaming API

When handling massive data sets, fetching large collections can overwhelm memory; Lettuce’s streaming API allows processing data as a stream.

Example 1

Example 2

3. Conclusion

Lettuce is worth studying in depth; see the official documentation:

https://github.com/lettuce-io/lettuce-core/wiki
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

javaAsynchronousNettySpring BootLettuceRedis Cluster
Java High-Performance Architecture
Written by

Java High-Performance Architecture

Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.