一、jar依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
二、demo示例
**@SpringBootTest**
public class Test {
// 要引入的Bean使用@Autowired注入
// 在要测试的方法上添加@org.junit.Test注释
**@org.junit.Test**
public void test(){
System.out.println("~~~~~~~~~~~~~~~~~");
}
}
使用@SpringBootTest和@org.junit.Test两个注解
三、demo运行