junit - 找不到:java.lang.NoClassDefFoundError:org/springframework/test/context/TestContextAnnotationUtils
问题描述
尝试执行 junit 测试时出现以下错误。我的 POM 文件也在下面:
错误:
测试被忽略。
java.lang.NoClassDefFoundError: org/springframework/test/context/TestContextAnnotationUtils
POM - 与 Spring 相关:
<!--Spring Dependencies-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-wiremock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-rabbit</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
解决方案
推荐阅读
- python - Odoo 10:无法在 python 中使用元素树解析日期字段
- python - 创建 pd.date_range 的 pandas 列
- python - (2002,“无法通过套接字'/tmp/mysql.sock'(2)连接到本地MySQL服务器”)
- php - 从数据库加载 Simplepie 提要 url
- ios - UIViewController 布局更改
- r - ggplot 在聚合年份极坐标直方图中用月份替换天数
- javascript - 从日期选择器复制值并设置焦点
- java - 聊天机器人问题
- regex - 正则表达式 If-Else 条件示例
- animation - 如何用 Flutter 在同屏路线上制作英雄风格的动画?