1 Reply Latest reply on Aug 6, 2007 7:42 AM by alesj

    Missing BeanFactory with no class usage

    alesj

      I guess we never tested this - beanfactory having no class/bean set.
      Since this code woudn't work then. ;-)

       public Object createBean() throws Throwable
       {
       ClassLoader cl = Configurator.getClassLoader(classLoader);
       BeanInfo info = configurator.getBeanInfo(bean, cl);
      


      Eventually TypeInfoFactory throws this:

       public TypeInfo getTypeInfo(String name, ClassLoader cl) throws ClassNotFoundException
       {
       if (name == null)
       throw new IllegalArgumentException("Null class name");
      


      But if bean exists, I can then probably try to impl my annotation support on that ...

        • 1. Re: Missing BeanFactory with no class usage
          alesj

           

          "alesj" wrote:
          I guess we never tested this - beanfactory having no class/bean set.
          Since this code woudn't work then. ;-)
           public Object createBean() throws Throwable
           {
           ClassLoader cl = Configurator.getClassLoader(classLoader);
           BeanInfo info = configurator.getBeanInfo(bean, cl);
          



          I've added this fix
           public Object createBean() throws Throwable
           {
           ClassLoader cl = Configurator.getClassLoader(classLoader);
           BeanInfo info = null;
           if (bean != null)
           info = configurator.getBeanInfo(bean, cl);
          
           Joinpoint joinpoint = configurator.getConstructorJoinPoint(info, constructor, null);
           Object result = joinpoint.dispatch();
           if (info == null && result != null)
           info = configurator.getBeanInfo(result.getClass());
          


          and also added tests that use constructor's factory + factoryMethod or factoryClass + factoryMethod.