目录
一、提示信息
Error:(3, 29) java: 程序包org.junit.jupiter.api不存在
二、Spring Boot 2.2 前后区别
❶Spring Boot 2.2 之前的测试类
package com.example.demo1; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class DemoApplicationTests { @Test public void contextLoads() { } }
❷Spring Boot 2.2 之后的测试类
package com.god.demo; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class DemoApplicationTests { @Test void contextLoads() { } }
❸Spring Boot 2.2 之前的 pom.xml
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.10.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent>
❹Spring Boot 2.2 之后的 pom.xml
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.3.2.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent>
程序包org.junit.jupiter.api不存在
最新推荐文章于 2025-02-14 09:57:39 发布