1 @RunWith(SpringJUnit4ClassRunner.class) // 使用junit4测试 2 @ContextConfiguration(locations={"classpath:applicationContext.xml"}) // 引入spring配置文件
使用上面两个注释之后需要测试的方法用 @Test 注解标识即可。