将公司项目中的redis升级到2.1.3之后,发现项目启动不了了,直接报错:“An attempt was made to call the method org.springframework.data.redis.cache.RedisCacheManager.<init>(Lorg/springframework/data/redis/core/RedisOperations;)V but it does not exist.”。
详细错误信息如下:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-09-09 19:48:55.612 [main] ERROR o.s.b.diagnostics.LoggingFailureAnalysisReporter -
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call the method org.springframework.data.redis.cache.RedisCacheManager.<init>(Lorg/springframework/data/redis/core/RedisOperations;)V but it does not exist. Its class, org.springframework.data.redis.cache.RedisCacheManager, is available from the following locations:
jar:file:/E:/repository/org/springframework/data/spring-data-redis/2.1.3.RELEASE/spring-data-redis-2.1.3.RELEASE.jar!/org/springframework/data/redis/cache/RedisCacheManager.class
It was loaded from the following location:
file:/E:/repository/org/springframework/data/spring-data-redis/2.1.3.RELEASE/spring-data-redis-2.1.3.RELEASE.jar
从错误信息中可以明确看到,这个问题是springboot和redis的版本不匹配所致,redis
的版本是2.1.3.RELEASE,而项目中的springboot
版本才1.5.3.RELEASE,由于公司项目中的springboot
版本是写在基础core包中的,所以当时没有注意到二者同步升级。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>
问题解决!!!
评论