加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java.lang.NoClassDefFoundError:org / springframework / data

发布时间:2020-12-15 03:00:31 所属栏目:Java 来源:网络整理
导读:我正在用 spring boot做这个项目,我试着编写一些测试,但遗憾的是我得到了这个异常堆栈跟踪: java.lang.IllegalStateException: Failed to load ApplicationContextCaused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to r
我正在用 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依赖项.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读