首先使用maven在pom.xml添加如下依赖 说明: SpringBoot从2.0起默认使用lettuce客户端进行连接。 此次使用的版本:springboot:2.6.6,lettuce:6.1.8。 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> 使用SpringBoot集成Lettuce连接实例 1、在application.properties配置文件中加上redis相关配置。 spring.redis.host=host spring.redis.database=0 spring.redis.password=pwd...