private static void addAnnotations(final DeploymentUnit deploymentUnit, Collection<AnnotationType> annotations) { for(AnnotationType annotation : annotations){ addAnnotation(deploymentUnit, annotation); } }
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (deploymentUnit.getParent() != null) { return; // only run for top-level deployments } final CompositeIndex index = deploymentUnit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX); // CDI built-in normal scopes plus @Dependent addAnnotations(deploymentUnit, CdiAnnotations.BEAN_DEFINING_ANNOTATIONS); // CDI @Model stereotype addAnnotation(deploymentUnit, new AnnotationType(CdiAnnotations.MODEL.getDotName(), false)); // EE7 built-in normal scopes and stereotypes addAnnotation(deploymentUnit, new AnnotationType(TransactionScoped.class)); addAnnotation(deploymentUnit, new AnnotationType(VIEW_SCOPED_NAME, true)); addAnnotation(deploymentUnit, new AnnotationType(FLOW_SCOPED_NAME, true)); for (AnnotationType annotationType : CdiAnnotations.BEAN_DEFINING_META_ANNOTATIONS) { addAnnotations(deploymentUnit, getAnnotationsAnnotatedWith(index, annotationType.getName())); } }
processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_WELD_CONFIGURATION, new WeldConfigurationProcessor(requireBeanDescriptor, nonPortableMode, developmentMode)); processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_CDI_ANNOTATIONS, new CdiAnnotationProcessor()); processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_CDI_BEAN_DEFINING_ANNOTATIONS, new BeanDefiningAnnotationProcessor()); processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_WELD_DEPLOYMENT, new BeansXmlProcessor()); processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_WELD_IMPLICIT_DEPLOYMENT_DETECTION, new WeldImplicitDeploymentProcessor());