private void addWeldIntegration ( final Iterable < ComponentIntegrator > componentIntegrators , final ComponentInterceptorSupport componentInterceptorSupport , final ServiceTarget target , final ComponentConfiguration configuration , final ComponentDescription description , final Class < ? > componentClass , final String beanName , final ServiceName weldServiceName , final ServiceName weldStartService , final ServiceName beanManagerService , final Set < Class < ? > > interceptorClasses , final ClassLoader classLoader , final String beanDeploymentArchiveId ) { final ServiceName serviceName = configuration . getComponentDescription ( ) . getServiceName ( ) . append ( "WeldInstantiator" ) ; final ServiceBuilder < ? > builder = target . addService ( serviceName ) ; builder . requires ( weldStartService ) ; configuration . setInstanceFactory ( WeldManagedReferenceFactory . INSTANCE ) ; configuration . getStartDependencies ( ) . add ( new DependencyConfigurator < ComponentStartService > ( ) { @ Override public void configureDependency ( final ServiceBuilder < ? > serviceBuilder , ComponentStartService service ) throws DeploymentUnitProcessingException { serviceBuilder . requires ( serviceName ) ; } } ) ; boolean isComponentIntegrationPerformed = false ; for ( ComponentIntegrator componentIntegrator : componentIntegrators ) { Supplier < ServiceName > bindingServiceNameSupplier = ( ) -> { if ( componentInterceptorSupport == null ) { throw WeldLogger . DEPLOYMENT_LOGGER . componentInterceptorSupportNotAvailable ( componentClass ) ; } return addWeldInterceptorBindingService ( target , configuration , componentClass , beanName , weldServiceName , weldStartService , beanDeploymentArchiveId , componentInterceptorSupport ) ; } ; DefaultInterceptorIntegrationAction integrationAction = ( bindingServiceName ) - > { if ( componentInterceptorSupport == null ) { throw WeldLogger . DEPLOYMENT_LOGGER . componentInterceptorSupportNotAvailable ( componentClass ) ; } addJsr299BindingsCreateInterceptor ( configuration , description , beanName , weldServiceName , builder , bindingServiceName , componentInterceptorSupport ) ; addCommonLifecycleInterceptionSupport ( configuration , builder , bindingServiceName , beanManagerService , componentInterceptorSupport ) ; configuration . addComponentInterceptor ( new UserInterceptorFactory ( factory ( InterceptionType . AROUND_INVOKE , builder , bindingServiceName , componentInterceptorSupport ) , factory ( InterceptionType . AROUND_TIMEOUT , builder , bindingServiceName , componentInterceptorSupport ) ) , InterceptorOrder . Component . CDI_INTERCEPTORS , false ) ; } ; if ( componentIntegrator . integrate ( beanManagerService , configuration , description , builder , bindingServiceNameSupplier , integrationAction , componentInterceptorSupport ) ) { isComponentIntegrationPerformed = true ; break ; } }
As the weld based instantiator needs access to the bean manager it is installed as a service .