第一步 在POM.XML配置,引入依赖
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency>
第二步 创建测试类,一如两个注解
@RunWith(SpringRunner.class)
@SpringBootTest //需要制定应用
public class SpringBootTests{}