// Get the CDI-enabled ValidatorFactory
ValidatorFactory validatorFactory = getReference(ValidatorFactory.class, beanManager);
// Replace the delegate of LazyValidatorFactory
LazyValidatorFactory lazyValidatorFactory = (LazyValidatorFactory)(deploymentUnit.getAttachment(BeanValidationAttachments.VALIDATOR_FACTORY));
lazyValidatorFactory.replaceDelegate(validatorFactory);
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(cl);
}
}