spring boot 整合junit
1,添加起步依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
2,在测试类中加上
@SpringBootTest注解
@RunWith(SpringRunner.class)
测试方法上加@Test

浙公网安备 33010602011771号