是否可以在 spring 项目中使用最新的绝地武士

is it possible to use the newest jedis in spring project

当我强制绝地武士使用 build.gradle 中的最新版本 4.2.3 时,如下所示:

resolutionStrategy {
            eachDependency { DependencyResolveDetails details ->
                
                if (details.requested.group == 'redis.clients' && details.requested.name == 'jedis' ) {
                    details.useVersion("4.2.3")
                }
            }
        }

spring 项目显示如下错误:

Caused by: java.lang.NoClassDefFoundError: redis.clients.jedis.GeoUnit
    at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.<clinit>(JedisConnectionFactory.java:93) ~[spring-data-redis-2.6.4.jar!/:2.6.4]
    at org.springframework.boot.autoconfigure.data.redis.JedisConnectionConfiguration.createJedisConnectionFactory(JedisConnectionConfiguration.java:74) ~[spring-boot-autoconfigure-2.6.7.jar!/:2.6.7]
    at org.springframework.boot.autoconfigure.data.redis.JedisConnectionConfiguration.redisConnectionFactory(JedisConnectionConfiguration.java:62) ~[spring-boot-autoconfigure-2.6.7.jar!/:2.6.7]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.19.jar!/:5.3.19]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.19.jar!/:5.3.19]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) ~[spring-beans-5.3.19.jar!/:5.3.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.19.jar!/:5.3.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.19.jar!/:5.3.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.19.jar!/:5.3.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.19.jar!/:5.3.19]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean[=12=](AbstractBeanFactory.java:335) ~[spring-beans-5.3.19.jar!/:5.3.19]
    at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda6/0x0000000070e22f90.getObject(Unknown Source) ~[?:?]

我想使用jedis的xpending功能,似乎spring引导数据与最新的jedis不兼容。可以解决这个问题吗?

简答,否

有一些用户 [1][2][3] 在使用 Jedis 4,但这是可能的,前提是您没有使用某些特定功能并且愿意完成一些额外的工作。


顺便说一句,spring-data-redis 正在 upgrading their support to Jedis 4 的路上。或许,你可以等待这次升级。