JedisPoolConfig is not assignable to GenericObjectPoolConfig

烈酒焚心 提交于 2019-12-04 06:05:47

Had exactly the same problem when I upgraded to Spring Data Redis v1.2.1-RELEASE. I solved the problem after upgrading Jedis to the latest version - v2.4.2. If you are using Maven, check the following dependencies.

<properties>
    <spring.data.redis>1.2.1.RELEASE</spring.data.redis>
    <jedis>2.4.2</jedis>
</properties>

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-redis</artifactId>
    <version>${spring.data.redis}</version>
</dependency>
<dependency>
    <groupId>redis.clients</groupId>
    <artifactId>jedis</artifactId>
    <version>${jedis}</version>
</dependency>

Hope this helps :)

You need to add a reference to the apache commons-pool2 library. I had the same problem in a Scala project - we were using sbt, so it was just a case of adding:

"org.apache.commons" % "commons-pool2" % "2.0"

As you're using Java, you might be using Maven, so I would expect it's probably more like this (untested - take it with a pinch of salt!):

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-pool2</artifactId>
    <version>2.0</version>
</dependency>

In case someone facing it due to migration from Spring Boot 1.5.x to 2.x.x here is thread that explains it. Also please see this link

Lettuce is now used instead of Jedis as the Redis driver when you use spring-boot-starter-data-redis. If you are using higher level Spring Data constructs you should find that the change is transparent.

We still support Jedis. Switch dependencies if you prefer Jedis by excluding io.lettuce:lettuce-core and adding redis.clients:jedis instead.

Connection pooling is optional and, if you are using it, you now need to add commons-pool2 yourself as Lettuce, contrary to Jedis, does not bring it transitively.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!