在刚开始学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..

Logo

助力广东及东莞地区开发者,代码托管、在线学习与竞赛、技术交流与分享、资源共享、职业发展,成为松山湖开发者首选的工作与学习平台

更多推荐