在原先4基礎(chǔ)+2(logging,log4j)+2(spring聯(lián)盟,weaver)+1(springTest),然后用junit測(cè)試即可
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:cn/itcast/d_springaop/applicationContext.xml")
public class Demo {
@Resource(name="userService")
private UserService us;
@Test
public void fun1(){
us.save();
}
}
順便提一句:普通單元測(cè)試如下
在代碼中右鍵,選擇goto->test,(或者cmd+shift+T)選擇類后
選擇類名,包名等即可進(jìn)行測(cè)試