引入依赖
pom 文件中添加以下依赖
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<skipTests>true</skipTests>
</properties>
建立测试类
@SpringBootTest(classes = GisBootApplication.class)//启动类
@RunWith(SpringRunner.class)
public class UserTest {
@Resource
private UserService userService;
@Test
public void main(){
}
}
标签:boot,junit,class,SpringBootTest,test,public
From: https://www.cnblogs.com/congshaoblog/p/17996737