use of org.jboss.as.weld.CdiValidatorFactoryService in project wildfly by wildfly.
the class CdiBeanValidationFactoryProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final DeploymentUnit topLevelDeployment = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent();
final ServiceName weldStartService = topLevelDeployment.getServiceName().append(ServiceNames.WELD_START_SERVICE_NAME);
if (!WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
return;
}
if (!deploymentUnit.hasAttachment(BeanValidationAttachments.VALIDATOR_FACTORY)) {
return;
}
final ServiceTarget serviceTarget = phaseContext.getServiceTarget();
final ServiceName serviceName = deploymentUnit.getServiceName().append(CdiValidatorFactoryService.SERVICE_NAME);
final CdiValidatorFactoryService cdiValidatorFactoryService = new CdiValidatorFactoryService(deploymentUnit);
serviceTarget.addService(serviceName, cdiValidatorFactoryService).addDependency(ServiceNames.beanManagerServiceName(deploymentUnit), new CastingInjector<BeanManager>(cdiValidatorFactoryService.getBeanManagerInjector(), BeanManager.class)).addDependency(weldStartService).install();
}
Aggregations