java.lang.NoClassDefFoundError:org / springframework / data / repository / config / BootstrapMode

我正在用 spring boot做这个项目,我试着编写一些测试,但遗憾的是我得到了这个异常堆栈跟踪:
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanDeFinitionStoreException: Failed to read candidate component class: file [somepath/config/PostgresJpaConfig.class]; nested exception is java.lang.NoClassDefFoundError: org/springframework/data/repository/config/BootstrapMode
Caused by: java.lang.NoClassDefFoundError: org/springframework/data/repository/config/BootstrapMode

我看看我的build.gradle中是否缺少某种依赖,但我不这么认为. BootstrapMode thingy在任何地方都不存在,甚至在Central Maven Repository上也不存在.我使用IntelliJ在整个项目中搜索任何类型的BootstrapMode外观,没有任何运气.

这些是我的gradle依赖项:

这将是我的测试用例:
Spring Boot Test Case

这是我的PostgrsJpaConfig类:
PostgresJpaConfig class

解决方法

TL;DR: I was mixing up Spring versions. Overriding one version with
another,which you shouldn’t do.

我应该使用org.springframework.boot:spring-boot-starter-data-jpa,而不是使用org.springframework.data依赖项.

相关文章

最近看了一下学习资料,感觉进制转换其实还是挺有意思的,尤...
/*HashSet 基本操作 * --set:元素是无序的,存入和取出顺序不...
/*list 基本操作 * * List a=new List(); * 增 * a.add(inde...
/* * 内部类 * */ 1 class OutClass{ 2 //定义外部类的成员变...
集合的操作Iterator、Collection、Set和HashSet关系Iterator...
接口中常量的修饰关键字:public,static,final(常量)函数...