spring-boot - 将 Spring Boot 升级到 2.4.2 时 org.springframework.test.context.TestContextAnnotationUtils 上的 ClassNotFoundException
问题描述
在我的 POM 中,我将 Spring Boot 的版本从 2.3.5.RELEASE 升级到了 2.4.2。结果,mvn clean test
现在失败并出现错误
java.lang.NoClassDefFoundError: org/springframework/test/context/TestContextAnnotationUtils
Caused by: java.lang.ClassNotFoundException: org.springframework.test.context.TestContextAnnotationUtils
在一个简单的测试中
package ch.ge.ael.enu.mediation;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class MediationApplicationTests {
@Test
void contextLoads() {
}
}
有人有线索吗?
解决方案
为我解决这个问题的方法是将我的spring-test
依赖版本从升级5.2.9.RELEASE
到5.3.8
推荐阅读
- java - 修改使用静态变量初始化的非静态变量的值也会修改静态变量
- c# - ASP.NET Core 2.1 Web API 的集成测试始终在“开发”模式下运行
- pandas - Pandas groupby-apply:无法从重复的轴重新索引
- javascript - aurelia 财产观察员没有被处置
- c# - ASP.NET Core 标识模型自定义选择列表
- python - 变量通过相同的操作得到不同的值
- javascript - 如何循环遍历数组内的多个数组并从中过滤值-Javascript
- c# - Streamwriter 反序列化/读入类型
- bash - 根据 hdfs 目录中的文件名计算文件数
- docker - Nginx CORS 政策问题