无法导入SpringApplicationContextLoader

use*_*ser 3 java spring intellij-idea maven

我使用IntelliJ IDEA编写Spring项目.

我添加了依赖

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

和Spring Boot有关.我无法使用以下方法导入SpringApplicationContextLoader:

import org.springframework.boot.test.SpringApplicationContextLoader

但是我在GitHub上看到很多使用这个类的项目.

我该如何查看该课程的当前包裹?

Seb*_*ian 12

根据SpringApplicatioNContextLoader a.4.x的javadoc,如果绝对必要,不推荐使用@SpringBootTest或SpringBootContextLoader.


Yoa*_*Gur 1

尝试将以下依赖项添加到您的 pom 中:

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot</artifactId>
   <version>1.1.1.RELEASE</version>
</dependency> 
Run Code Online (Sandbox Code Playgroud)

请参阅: https: //1maven.com/idartifact/org.springframework.boot: spring-boot:1.1.1.RELEASE