spring与junit整合测试
生活随笔
收集整理的這篇文章主要介紹了
spring与junit整合测试
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1.導(dǎo)包4+2+aop+test
這里不愿意截圖了,上面講注解配置時(shí)候有截圖2.配置注解
//幫我們創(chuàng)建容器 @RunWith(SpringJUnit4ClassRunner.class) //指定創(chuàng)建容器時(shí)使用哪個(gè)配置文件 @ContextConfiguration("classpath:applicationContext.xml") public class Demo {//將名為user的對象注入到u變量中@Resource(name="user")private User u;@Testpublic void fun1(){System.out.println(u);}總結(jié)
以上是生活随笔為你收集整理的spring与junit整合测试的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: lucene Term查询
- 下一篇: 设置python路径