use of org.springframework.validation.MessageCodesResolver in project spring-framework by spring-projects.
the class WebFluxConfigurationSupport method getConfigurableWebBindingInitializer.
/**
* Return the {@link ConfigurableWebBindingInitializer} to use for
* initializing all {@link WebDataBinder} instances.
*/
protected ConfigurableWebBindingInitializer getConfigurableWebBindingInitializer(FormattingConversionService webFluxConversionService, Validator webFluxValidator) {
ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer();
initializer.setConversionService(webFluxConversionService);
initializer.setValidator(webFluxValidator);
MessageCodesResolver messageCodesResolver = getMessageCodesResolver();
if (messageCodesResolver != null) {
initializer.setMessageCodesResolver(messageCodesResolver);
}
return initializer;
}
use of org.springframework.validation.MessageCodesResolver in project spring-framework by spring-projects.
the class TestPathHelper method testMessageCodesResolver.
@Test
public void testMessageCodesResolver() {
loadBeanDefinitions("mvc-config-message-codes-resolver.xml");
RequestMappingHandlerAdapter adapter = this.appContext.getBean(RequestMappingHandlerAdapter.class);
assertThat(adapter).isNotNull();
Object initializer = adapter.getWebBindingInitializer();
assertThat(initializer).isNotNull();
MessageCodesResolver resolver = ((ConfigurableWebBindingInitializer) initializer).getMessageCodesResolver();
assertThat(resolver).isNotNull();
assertThat(resolver.getClass()).isEqualTo(TestMessageCodesResolver.class);
assertThat(new DirectFieldAccessor(adapter).getPropertyValue("ignoreDefaultModelOnRedirect")).asInstanceOf(BOOLEAN).isFalse();
}
use of org.springframework.validation.MessageCodesResolver in project spring-framework by spring-projects.
the class WebMvcConfigurationSupport method getConfigurableWebBindingInitializer.
/**
* Return the {@link ConfigurableWebBindingInitializer} to use for
* initializing all {@link WebDataBinder} instances.
*/
protected ConfigurableWebBindingInitializer getConfigurableWebBindingInitializer(FormattingConversionService mvcConversionService, Validator mvcValidator) {
ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer();
initializer.setConversionService(mvcConversionService);
initializer.setValidator(mvcValidator);
MessageCodesResolver messageCodesResolver = getMessageCodesResolver();
if (messageCodesResolver != null) {
initializer.setMessageCodesResolver(messageCodesResolver);
}
return initializer;
}
Aggregations