问题描述
最近使用Springboot 整合Redis出现了这类问题:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘redisTemplate’ defined in URL [org…; nested exception is java.lang.NoSuchMethodError: org.springframework.core.serializer.support.DeserializingConverter
这是由于jedis 和spring-boot-starter-data-redis 的maven依赖的版本不兼容导致, 是经常会出现的问题。
出现JedisConnectionFactory 无法创建也是一样。
解决如下
为了修改版本号,尝试了很久的,终于找到了两个可以兼容的版本,使用如下依赖,起码笔者没有问题。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<version>2.1.3.RELEASE</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.9.1</version>
</dependency>