美文网首页Spring Boot
SpringBoot —程序包org.springframewo

SpringBoot —程序包org.springframewo

作者: 少缶 | 来源:发表于2021-04-25 11:25 被阅读0次

一. 遇到问题 :程序包org.springframework.boot.test.context不存在


发生错误的原因是项目中缺少spring-boot-starter-test依赖导致的,解决方案如下:
1. Maven管理:

在项目根目录的pom.xm文件中的<dependencies>节点下增加以下依赖即可:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
</dependency>
2. Gradle管理:

在项目的src目录的build.gradle.kts文件中,找到dependencies增加以下依赖即可:

testImplementation("org.springframework.boot:spring-boot-starter-test")

二. 遇到问题 :程序包org.junit.jupiter.api不存在


发生错误的原因是和问题一org.springframework.boot.test.context不存在的是一样的,都是因为缺少spring-boot-starter-test依赖导致的,解决方案同上。

相关文章

网友评论

    本文标题:SpringBoot —程序包org.springframewo

    本文链接:https://www.haomeiwen.com/subject/achdrltx.html