[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Missing BeanFactory with no class usage

alesj do-not-reply at jboss.com
Mon Aug 6 07:42:33 EDT 2007


"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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071132#4071132

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071132



More information about the jboss-dev-forums mailing list