原因 spring boot 2.2 之前使用的是 Junit4 而后续的使用的是Junit5,导致缺少包。 解决方法 导入包 <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-api</artifactId> <version>5.5.0</version> <scope>test</scope> </dependency>