use of org.springframework.validation.beanvalidation.LocalValidatorFactoryBean in project spring-framework by spring-projects.
the class DelegatingWebMvcConfigurationTests method getCustomValidator.
@Test
public void getCustomValidator() {
given(webMvcConfigurer.getValidator()).willReturn(new LocalValidatorFactoryBean());
delegatingConfig.setConfigurers(Collections.singletonList(webMvcConfigurer));
delegatingConfig.mvcValidator();
verify(webMvcConfigurer).getValidator();
}
use of org.springframework.validation.beanvalidation.LocalValidatorFactoryBean in project spring-framework by spring-projects.
the class DelegatingWebMvcConfigurationTests method requestMappingHandlerAdapter.
@Test
public void requestMappingHandlerAdapter() throws Exception {
delegatingConfig.setConfigurers(Collections.singletonList(webMvcConfigurer));
RequestMappingHandlerAdapter adapter = delegatingConfig.requestMappingHandlerAdapter();
ConfigurableWebBindingInitializer initializer = (ConfigurableWebBindingInitializer) adapter.getWebBindingInitializer();
ConversionService initializerConversionService = initializer.getConversionService();
assertTrue(initializer.getValidator() instanceof LocalValidatorFactoryBean);
verify(webMvcConfigurer).configureMessageConverters(converters.capture());
verify(webMvcConfigurer).configureContentNegotiation(contentNegotiationConfigurer.capture());
verify(webMvcConfigurer).addFormatters(conversionService.capture());
verify(webMvcConfigurer).addArgumentResolvers(resolvers.capture());
verify(webMvcConfigurer).addReturnValueHandlers(handlers.capture());
verify(webMvcConfigurer).configureAsyncSupport(asyncConfigurer.capture());
assertSame(conversionService.getValue(), initializerConversionService);
assertEquals(0, resolvers.getValue().size());
assertEquals(0, handlers.getValue().size());
assertEquals(converters.getValue(), adapter.getMessageConverters());
assertNotNull(asyncConfigurer);
}
use of org.springframework.validation.beanvalidation.LocalValidatorFactoryBean in project SpringStepByStep by JavaProgrammerLB.
the class MvcConfig method getValidator.
@Override
public Validator getValidator() {
LocalValidatorFactoryBean factory = new LocalValidatorFactoryBean();
factory.setValidationMessageSource(messageSource);
return factory;
}
use of org.springframework.validation.beanvalidation.LocalValidatorFactoryBean in project camel by apache.
the class CamelTestConfiguration method getValidatorFactory.
@Bean
public LocalValidatorFactoryBean getValidatorFactory() {
final LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
localValidatorFactoryBean.getValidationPropertyMap().put("hibernate.validator.fail_fast", "true");
return localValidatorFactoryBean;
}
use of org.springframework.validation.beanvalidation.LocalValidatorFactoryBean in project camel by apache.
the class ValidatorConfiguration method getValidatorFactory.
@Bean
public LocalValidatorFactoryBean getValidatorFactory() {
final LocalValidatorFactoryBean localValidatorFactoryBean = new LocalValidatorFactoryBean();
localValidatorFactoryBean.getValidationPropertyMap().put("hibernate.validator.fail_fast", "true");
return localValidatorFactoryBean;
}
Aggregations