I am upgrading the spring boot from 1.5.3 version to 2.1.6 release. I have added below dependencies:
classpath('org.springframework.boot:spring-boot-gradle-plugin:2.1.6.RELEASE')
compile('org.springframework.boot:spring-boot-starter-data-redis')
{
exclude group: 'io.lettuce', module: 'lettuce-core'
}
compile('redis.clients:jedis:2.9.0')
I am getting below error:
Caused by: java.lang.NoSuchMethodError: org.springframework.data.redis.core.RedisTemplate.delete(Ljava/lang/Object;)V at com.aonhewitt.upoint.cache.config.provider.impl.RedisCacheObjectProviderImpl.delete(RedisCacheObjectProviderImpl.java:292) at com.aonhewitt.upoint.cache.util.DistributedCacheUtil.deleteCacheKey(DistributedCacheUtil.java:490) at com.aonhewitt.upoint.cache.util.DistributedCacheUtil$$FastClassBySpringCGLIB$$10d7e0fa.invoke() at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684) at com.aonhewitt.upoint.cache.util.DistributedCacheUtil$$EnhancerBySpringCGLIB$$15db3ca8.deleteCacheKey() at com.aonhewitt.upoint.portal.configuration.util.ConfigurationParmUtil.manageClntParmKeysInRedis(ConfigurationParmUtil.java:49) at com.aonhewitt.portal.configuration.workengine.ConfigurationController.processRequest(ConfigurationController.java:234) at com.aonh ewitt.portal.configuration.workengine.ConfigurationGateway.processRequest(ConfigurationGateway.java:56) at com.aonhewitt.portal.configuration.service.util.ConfigurationInit.load(ConfigurationInit.java:34) at com.aonhewitt.upoint.core.ConfigMgrStartUp.init(ConfigMgrStartUp.java:59) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBef oreInitializatio
只需检查您的依赖项并删除旧版本的 spring-data 依赖项
You have got both the starter-data-redis and jedis-client. Jedis works with spring-data-redis. Or starter-data-redis works by itself. The below combination worked for me:
org.springframework.data:spring-data-redis:jar:2.4.8:compile redis.clients:jedis:jar:3.3.0:compile
Reference link: https://www.baeldung.com/spring-data-redis-tutorial
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.