public Validator mvcValidator() {
return validatorDelegate;
}
private void setValidator( Validator implementation ) {
Validator validator = implementation;
if ( validator == null ) {
if ( ClassUtils.isPresent( "javax.validation.Validator", getClass().getClassLoader() ) ) {
Class<?> clazz;
try {
String className = "org.springframework.validation.beanvalidation.LocalValidatorFactoryBean";
clazz = ClassUtils.forName( className, WebMvcConfigurationSupport.class.getClassLoader() );
}
catch ( ClassNotFoundException e ) {
throw new BeanInitializationException( "Could not find default validator", e );
}
catch ( LinkageError e ) {
throw new BeanInitializationException( "Could not find default validator", e );
}
validator = (Validator) BeanUtils.instantiate( clazz );
}
else {
validator = new Validator()
{
public boolean supports( Class<?> clazz ) {
return false;
}