记spring boot配置redis 项目启动时的一个奇怪的错误

4 篇文章 0 订阅
1 篇文章 0 订阅

在刚开始学redis时,我照着网上的教程,把redis和jedis整合到spring boot,整合完毕后,启动项目总是失败,总是爆出下面的错误:【Correct the classpath of your application so that it contains a single, compatible version of org.springframework.data.repository.config.RepositoryConfigurationSource】

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call the method org.springframework.data.repository.config.RepositoryConfigurationSource.getAttribute(Ljava/lang/String;)Ljava/lang/String; but it does not exist. Its class, org.springframework.data.repository.config.RepositoryConfigurationSource, is available from the following locations:

jar:file:/D:/m2/repository/org/springframework/data/spring-data-commons/2.0.10.RELEASE/spring-data-commons-2.0.10.RELEASE.jar!/org/springframework/data/repository/config/RepositoryConfigurationSource.class

It was loaded from the following location:

file:/D:/m2/repository/org/springframework/data/spring-data-commons/2.0.10.RELEASE/spring-data-commons-2.0.10.RELEASE.jar

Action:

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.data.repository.config.RepositoryConfigurationSource

2018-11-22 13:03:51.398 INFO 2196 --- [ main] ConfigServletWebServerApplicationContext : Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@1a451d4d: startup date [Thu Nov 22 13:03:50 CST 2018]; root of context hierarchy

Process finished with exit code 1

然后我在网上找了很久,都没有关于这个错误的解决办法,偶然看到一篇博客,它在启动项目时也出现了类型错误,也是jar包冲突,然后那个博主是通过改redis和jedis的版本号解决的,我也把版本号都改成和那个博主相同的,但启动后还是出现相同的错误。

后来就想如果我把版本号都去掉,让“spring-boot-starter-parent”自动为我们提供对应版本的jar包,这样就可以避免自己指定版本号时,可能会有一些意想不到的冲突。于是我就把redis和jedis的版本号都去掉,果然项目就可以正常启动了~~

What a strange error..

  • 11
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 9
    评论
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值