Package org.nutz.ioc.impl

Examples of org.nutz.ioc.impl.ScopeContext


        assertEquals("F2", f2.getName());
        Animal f22 = ioc.get(Animal.class, "f2");
        assertEquals("F2", f22.getName());
        assertFalse(f2 == f22);

        ScopeContext ic = new ScopeContext("MyScope");
        Map<String, ObjectProxy> map = ic.getObjs();
        f2 = ioc.get(Animal.class, "f2", ic);
        assertEquals("F2", f2.getName());
        f22 = ioc.get(Animal.class, "f2", ic);
        assertEquals("F2", f22.getName());
        assertTrue(f2 == f22);
View Full Code Here


        IocContext ic;
    }

    @Test
    public void test_refer_context() {
        IocContext context = new ScopeContext("abc");
        String json = "{obj:{singleton:false,fields:{ic:{refer:'$conText'}}}}";
        Ioc2 ioc = new NutIoc(new MapLoader(json), context, "abc");
        TestReferContext trc = ioc.get(TestReferContext.class);
        assertTrue(context == trc.ic);

        IocContext context2 = new ScopeContext("rrr");
        trc = ioc.get(TestReferContext.class, "obj", context2);
        assertTrue(trc.ic instanceof ComboContext);
    }
View Full Code Here

public class ComboIocProvider implements IocProvider {

    public Ioc create(NutConfig config, String[] args) {
        try {
            return new NutIoc(new ComboIocLoader(args), new ScopeContext("app"), "app");
        }
        catch (ClassNotFoundException e) {
            throw Lang.wrapThrow(e);
        }
    }
View Full Code Here

import org.nutz.mvc.NutConfig;

public class XmlIocProvider implements IocProvider {

    public Ioc create(NutConfig config, String[] args) {
        return new NutIoc(new XmlIocLoader(args), new ScopeContext("app"), "app");
    }
View Full Code Here

public class AnnotationIocProvider implements IocProvider {

    public Ioc create(NutConfig config, String[] args) {
      if (args == null || args.length == 0)
        args = new String[]{config.getMainModule().getPackage().getName()};
        return new NutIoc(new AnnotationIocLoader(args), new ScopeContext("app"), "app");
    }
View Full Code Here

import org.nutz.mvc.NutConfig;

public class JsonIocProvider implements IocProvider {

    public Ioc create(NutConfig config, String[] args) {
        return new NutIoc(new JsonLoader(args), new ScopeContext("app"), "app");
    }
View Full Code Here

TOP

Related Classes of org.nutz.ioc.impl.ScopeContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.