我正在处理一个项目,我看到定义了这些依赖关系:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>但是我不明白为什么使用Spring测试有两个工件,两者之间有什么区别呢?也许与后者,我也是进口前者?
发布于 2020-04-09 09:59:03
spring-boot-starter-test是一个聚合的“初学者包”,用于库,通常用于在Spring应用程序中进行测试。
正如最新版本参考文档中所述,spring-boot-starter-test包含:
spring-boot-test依赖项)可以删除spring-boot-test依赖项的显式定义。
发布于 2020-04-09 09:39:18
从Spring官方参考:
Spring在测试应用程序时提供了许多实用程序和注释来帮助您。测试支持由两个模块提供:spring Test包含核心项,以及spring-启动-测试-自动配置支持测试的自动配置。
发布于 2020-05-08 07:10:34
请看一下maven定义。包裹的内容在那里很详细。弹簧启动测试似乎是一个超集的春季启动测试,因为春季启动启动测试有依赖于春季启动测试。
https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test/2.2.5.RELEASE
https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-test/2.2.5.RELEASE
https://stackoverflow.com/questions/61117933
复制相似问题