我正在处理一个项目,我看到定义了这些依赖项:
<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>
但是我不明白为什么有 2 个 Artifact 用于 Spring Boot 测试,它们之间有什么区别?也许对于后者,我也在导入前者?
最佳答案
spring-boot-starter-test
是一个聚合的“入门包”,用于经常一起用于在 Spring 应用程序中进行测试的库。
如最新版本引用 documentation 中所述, spring-boot-starter-test
包含:
spring-boot-test
依赖)关于spring - spring-boot-test 与 spring-boot-starter-test 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61117933/