仔細看看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") // ... }