Package org.tamacat.di.impl

Source Code of org.tamacat.di.impl.DIContainer_test$Sub

/*
* Copyright (c) 2009, TamaCat.org
* All rights reserved.
*/
package org.tamacat.di.impl;

import org.tamacat.di.DIContainer;
import org.tamacat.di.define.BeanDefine;
import org.tamacat.di.define.BeanDefineMap;
import org.tamacat.util.ClassUtils;

public class DIContainer_test {

  /**
   * @param args
   */
  public static void main(String[] args) {
    ClassLoader loader = ClassUtils.getDefaultClassLoader();//new UnloadableClassLoader();
    BeanDefineMap defines = new BeanDefineMap();
   
    BeanDefine def1 = new BeanDefine();
        def1.setId("super");
        def1.setType("org.tamacat.di.impl.DIContainer_test$Super", loader);
        def1.setSingleton(false);
        defines.put(def1.getId(), def1);
       
    BeanDefine def2 = new BeanDefine();
        def2.setId("sub");
        def2.setType("org.tamacat.di.impl.DIContainer_test$Sub", loader);
        def2.setSingleton(false);
        defines.put(def2.getId(), def2);
       
    DIContainer di = new TamaCatDIContainer(defines, loader);
    Super get1 = di.getBean("sub", Super.class);
    System.out.println(get1);
   
    Super get2 = di.getBean("sub", Sub.class);
    System.out.println(get2);
  }

  public static class Super {}
 
  public static class Sub extends Super {}
}
TOP

Related Classes of org.tamacat.di.impl.DIContainer_test$Sub

TOP
Copyright © 2018 www.massapi.com. 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.