use of org.jboss.as.ee.beanvalidation.LazyValidatorFactory in project wildfly by wildfly.
the class CdiValidatorFactoryService method start.
@Override
public void start(final StartContext context) throws StartException {
final ClassLoader cl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader);
BeanManager beanManager = beanManagerInjector.getValue();
// 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);
}
}
Aggregations