SpringBoot整合Junit
1.添加Junit的起步依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
2.测试类
@RunWith(SpringRunner.class)
@SpringBootTest(classes = MySpringBootApplication.class)
public class BootTest {
@Autowired
private UserDao userDao;
@Test
public void test01(){
List<User> users = userDao.getUser();
System.out.println(users);
}
}