仔细看看SpringBoot官方提供的参考手册会发现:html
关于Redis部分,springboot支持jedis和lettuce。可是默认配置的是lettuce。git
若是要使用jedis方式处理redis,须要特殊配置,官方参考手册也提示须要特殊配置。github
配置方式主要是修改pom.xml文件:redis
https://docs.spring.io/spring-boot/docs/2.0.0.BUILD-SNAPSHOT/reference/htmlsingle/#howto-use-jedis-instead-of-lettucespring
The Spring Boot starter (spring-boot-starter-data-redis
) uses Lettuce by default. You need to exclude that dependency and include the Jedis one instead. Spring Boot manages these dependencies to help make this process as easy as possible.springboot
Example in Maven:spring-boot
<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>
Example in Gradle:this
configurations { compile.exclude module: "lettuce" } dependencies { compile("redis.clients:jedis") // ... }