spring 單元測(cè)試
-
單單使用junit無(wú)法讀取xml文件,無(wú)法找到注入的bean,所以使用spring的單元測(cè)試
@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:spring-mybatis.xml") public class UserServiceTest { @Resource private IUserService userService; @Test public void getAllUsers() { List<User> list = userService.getAllUsers(); System.out.println(list); } @Test public void getUserByUid() { } }