Spring 2.4.0 的测试引擎 junit-vintage

从 Spring Boot 2.4.0 的测试引擎已经使用 Junit 5 的测试了。

因此测试引擎不再需要 exclude junit-vintage 到 Spring Boot 的测试依赖了。

2.4.0 的测试实例应该使用下面的依赖配置:

        <!-- TESTS -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>

这个问题在 2.3.3 的版本出现了上面的问题,有关这个问题的描述和解决方法,请参考:JUnit 5 测试 Spring 引擎的时候提示 junit-vintage 错误

中的内容。

测试引擎 junit-vintage 主要是版本兼容性的问题。

https://www.ossez.com/t/spring-2-4-0-junit-vintage/13243

原文地址:https://www.cnblogs.com/huyuchengus/p/14342843.html