private void initializeManagedObjectFactoryOrConstructor ( BeanMetaData bmd ) throws EJBConfigurationException { if ( bmd . isManagedBean ( ) ) { bmd . ivEnterpriseBeanFactory = getManagedBeanManagedObjectFactory ( bmd , bmd . enterpriseBeanClass ) ; // If the managed object factroy and the managed object instances will perform all injection // and interceptor processing, then save that indication and reset all of the methodinfos so // that AroundInvoke is not handled by the EJB Container. Injection, PostConstruct, and // PreDestroy will also be skipped. if ( bmd . ivEnterpriseBeanFactory != null && bmd . ivEnterpriseBeanFactory . managesInjectionAndInterceptors ( ) ) { bmd . managedObjectManagesInjectionAndInterceptors = true ; if ( bmd . ivInterceptorMetaData != null && bmd . localMethodInfos != null ) { for ( EJBMethodInfoImpl mbMethod : bmd . localMethodInfos ) { mbMethod . setAroundInterceptorProxies ( null ) ; } } } } else { bmd . ivEnterpriseBeanFactory = getEJBManagedObjectFactory ( bmd , bmd . enterpriseBeanClass ) ; } if ( bmd . ivEnterpriseBeanFactory == null ) { try { bmd . ivEnterpriseBeanClassConstructor = bmd . enterpriseBeanClass . getConstructor ( ( Class < ? > [ ] ) null ) ; } catch ( NoSuchMethodException e ) { Tr . error ( tc , "JIT_NO_DEFAULT_CTOR_CNTR5007E" , new Object [ ] { bmd . enterpriseBeanClassName , bmd . enterpriseBeanName } ) ; throw new EJBConfigurationException ( "CNTR5007E: The " + bmd . enterpriseBeanClassName + " bean class for the " + bmd . enterpriseBeanName + " bean does not have a public constructor that does not take parameters." ) ; } } // Removed else clause that calls bmd.ivEnterpriseBeanFactory.getConstructor() because this method // is called before cdiMMD.setWebBeansContext(webBeansContext) in LibertySingletonServer. If we call // getConstructor before setting the webBeansContext, we default to a constructor that may not be correct. // eg. returning no-arg constructor when multi-arg constructor injection should be invoked. }
Create the appropriate ManagedObjectFactory for the bean type or obtain the constructor if a ManagedObjectFactory will not be used .