必须先有JUnit的环境(已经导入了Junit4的开发环境)
1.导入jar包
2.在测试类上添加注解
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
public class Demo2 {
@Resource(name="helloService")
private HelloService helloService;
@Test
public void m01(){
helloService.sayHello();
}
}