Spring Boot 测试提示错误 TestEngine with ID 'junit-vintage' failed to discover tests

提示错误信息:

TestEngine with ID 'junit-vintage' failed to discover tests

错误和修改

错误的原因是因为在升级 Spring Boot 2.3 到 2.4 的时候。

        <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>
            </exclusions>
        </dependency>

这是因为 Spring Boot 2.3 升级到 2.4 之前,我们会 exclude junit-vintage-engine

在升级到 2.4 的时候,我们可以取消掉掉这个。

升级到 2.4 后,不再需要上面的代码。