测试步骤: 在之前的文章中已经加了junit的环境,这就不需要了. 1.加载junit类,spring配置文件,指明junit测试器,@Runwith 2.定义变量,service,不可以使用spring注解,因为spring注解是建立在server上的. 3.初始化@Before注解. 4.实现测试方法,@Test注解. package swust.edu.cn.postdoctors.service.impl; import javax.annotation.Resource; import