RichFacesBeanValidatorFactory validatorFactory = new RichFacesBeanValidatorFactory();
validatorFactory.init();
service = new BeanValidatorServiceImpl(new ValueExpressionAnalayserImpl(), validatorFactory);
} catch (InitializationException e) {
// JSR-303 is available but not initialised.
service = new DummyBeanValidatorService();
} catch (NoClassDefFoundError e) {
// JSR-303 is not avalable.
// log.warn("Validator implementations not found at classpath, default NullValidator will be used.");
service = new DummyBeanValidatorService();
}
factory.setInstance(BeanValidatorService.class, service);
}