org.nutz.ioc.loader.combo.ComboIocLoader Java Examples

The following examples show how to use org.nutz.ioc.loader.combo.ComboIocLoader. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WxsTest.java    From nutzwx with Apache License 2.0 6 votes vote down vote up
@Test
public void test_ioc_load() throws ClassNotFoundException {
    // 仿真一个配置文件
       PropertiesProxy conf = new PropertiesProxy();
       conf.put("weixin.atstore", "jedis"); // 测试jedisAgent存储AccessToken
       conf.put("weixin.token", "1234567890");
       conf.put("weixin.appid", "wx10927e35a365fe1c");
       conf.put("weixin.appsecret", "c29accd1784e636d6478eac9b6b3aYYY"); // YYY是假的
       conf.put("weixin.openid", "XXX");
       
       // 沙箱测试
    // http://mp.weixin.qq.com/debug/cgi-bin/sandboxinfo?action=showinfo&t=sandbox/index
    NutIoc ioc = new NutIoc(new ComboIocLoader("*weixin", "*jedis"));
    ioc.getIocContext().save("app", "conf", new ObjectProxy(conf));
    
    WxApi2 wxApi2 = ioc.get(WxApi2.class);
    for (int i = 0; i < 6; i++) {
        wxApi2.get_industry();
       }
    ioc.depose();
}
 
Example #2
Source File: NutzTest.java    From hasor with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Throwable {
    Ioc ioc = new NutIoc(new ComboIocLoader("*js", "ioc/", "*hasor"));
    //
    // .启动 Hasor
    ioc.get(AppContext.class);
    System.out.println("start.");
    //
    //Client -> Server
    HasorBean hasorBean = ioc.get(AppContext.class).getInstance(HasorBean.class);
    System.out.println(hasorBean);
    //
    ioc.depose();
}
 
Example #3
Source File: TestNutz.java    From snakerflow with Apache License 2.0 4 votes vote down vote up
@Before
public void before() throws ClassNotFoundException {
	IocLoader loader = new ComboIocLoader("*js", "ioc.js", "*"+SnakerIocLoader.class.getName());
    ioc = new NutIoc(loader);
    engine = ioc.get(SnakerEngine.class);
}