final Consumer<BeanManager> beanManagerConsumer = builder.provides(beanManagerServiceName); final Supplier<WeldBootstrapService> weldContainerSupplier = builder.requires(weldServiceName); builder.setInstance(new BeanManagerService(rootBda.getId(), beanManagerConsumer, weldContainerSupplier)); builder.install();
public WeldBootstrapService(WeldDeployment deployment, Environment environment, final String deploymentName) { this.deployment = deployment; this.environment = environment; this.deploymentName = deploymentName; this.bootstrap = new WeldBootstrap(); Map<String, BeanDeploymentArchive> bdas = new HashMap<String, BeanDeploymentArchive>(); for (BeanDeploymentArchive archive : deployment.getBeanDeploymentArchives()) { bdas.put(archive.getId(), archive); } bdas.put(deployment.getAdditionalBeanDeploymentArchive().getId(), deployment.getAdditionalBeanDeploymentArchive()); this.beanDeploymentArchives = Collections.unmodifiableMap(bdas); }
private void processEEComponents(DeploymentUnit deploymentUnit, Map<ResourceRoot, BeanDeploymentArchiveImpl> bdaMap, BeanDeploymentArchiveImpl rootBda, Map<ResourceRoot, Index> indexes, DeploymentReflectionIndex reflectionIndex) { final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION); for (ComponentDescription component : moduleDescription.getComponentDescriptions()) { BeanDeploymentArchiveImpl bda = resolveComponentBda(component.getComponentClassName(), bdaMap, rootBda, indexes); component.setBeanDeploymentArchiveId(bda.getId()); if (component instanceof EJBComponentDescription) { final EJBComponentDescription componentDescription = (EJBComponentDescription) component; //first we need to resolve the correct BDA for the bean bda.addEjbDescriptor(new EjbDescriptorImpl<Object>(componentDescription, bda, reflectionIndex)); } } }
BeanManagerService beanManagerService = new BeanManagerService(rootBda.getId()); serviceTarget.addService(beanManagerServiceName, beanManagerService).addDependency(weldServiceName, WeldBootstrapService.class, beanManagerService.getWeldContainer()).install();