单元测试

/**
* @Author: yinjing
* @Description:
* @Date: 13:31 2018/6/12
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath:spring_common.xml","classpath:wx_dubbo_customer.xml","classpath:wx_dubbo.xml"})
public class TestController {
@Autowired
// @Qualifier("wxJobApiImpl ")
private IWxJobApi wxJobApi;
@Test
public void test() {
// IWxJobApi s = new WxJobApiImpl();
// System.out.println(s);
// s.synLocalToWechat();
wxJobApi.synLocalToWechat();
}
}

要注入spring管理的bean需要@RunWith(SpringJUnit4ClassRunner.class) 
@ContextConfiguration(locations={"classpath:spring_common.xml","classpath:wx_dubbo_customer.xml","classpath:wx_dubbo.xml"})。

给同一个类(bean)不要取两个名字

posted @ 2018-06-12 16:04  神只吃苹果  阅读(103)  评论(0编辑  收藏  举报