# Spring 2.4.0 的测试引擎 junit-vintage

**URL:** <https://www.isharkfly.com/t/spring-2-4-0-junit-vintage/13243>\
**Category:** 程序语言\
**Tags:** java, spring\
**Created:** [January 28, 2021, 7:42pm UTC](https://www.isharkfly.com/t/spring-2-4-0-junit-vintage/13243 "2021-01-28T19:42:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucas](https://www.isharkfly.com/user_avatar/www.isharkfly.com/lucas/32/20805_2.png) [@lucas](https://www.isharkfly.com/u/lucas)\
**Post date:** [January 28, 2021, 7:42pm UTC](https://www.isharkfly.com/t/spring-2-4-0-junit-vintage/13243/1 "2021-01-28T19:42:43Z")

</div>

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

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

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

```auto
        <!-- 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 错误](https://www.isharkfly.com/t/junit-5-spring-junit-vintage/562)

中的内容。

 ![spring-test-01](https://com-ossez-www-discourse.s3.dualstack.us-east-2.amazonaws.com/discourse-uploads/original/2X/f/f02c0f6359c7d19585a18d75658124bf9394ae0a.png)

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