Search in sources :

Example 26 with ConfigurableWebBindingInitializer

use of org.springframework.web.bind.support.ConfigurableWebBindingInitializer in project spring-data-document-examples by spring-projects.

the class HandlerAdapterConfiguration method annotationMethodHandlerAdapter.

@Bean
public AnnotationMethodHandlerAdapter annotationMethodHandlerAdapter() {
    AnnotationMethodHandlerAdapter adapter = new AnnotationMethodHandlerAdapter();
    ActionInterceptor[] interceptors = new ActionInterceptor[] { datastoreInterceptor };
    //adapter.setActionInterceptors(interceptors);
    ConfigurableWebBindingInitializer wbi = new ConfigurableWebBindingInitializer();
    wbi.setValidator(getValidator());
    wbi.setConversionService(conversionService());
    adapter.setWebBindingInitializer(wbi);
    adapter.setMessageConverters(getMessageConverters());
    adapter.setOrder(-1);
    return adapter;
}
Also used : ConfigurableWebBindingInitializer(org.springframework.web.bind.support.ConfigurableWebBindingInitializer) ActionInterceptor(org.springframework.data.document.web.servlet.ActionInterceptor) AnnotationMethodHandlerAdapter(org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter) FormattingConversionServiceFactoryBean(org.springframework.format.support.FormattingConversionServiceFactoryBean) Bean(org.springframework.context.annotation.Bean) LocalValidatorFactoryBean(org.springframework.validation.beanvalidation.LocalValidatorFactoryBean)

Aggregations

ConfigurableWebBindingInitializer (org.springframework.web.bind.support.ConfigurableWebBindingInitializer)26 Test (org.junit.Test)17 MethodParameter (org.springframework.core.MethodParameter)8 DefaultDataBinderFactory (org.springframework.web.bind.support.DefaultDataBinderFactory)8 BindingContext (org.springframework.web.reactive.BindingContext)8 DefaultFormattingConversionService (org.springframework.format.support.DefaultFormattingConversionService)7 WebDataBinderFactory (org.springframework.web.bind.support.WebDataBinderFactory)7 Before (org.junit.Before)6 DefaultConversionService (org.springframework.core.convert.support.DefaultConversionService)6 LocalValidatorFactoryBean (org.springframework.validation.beanvalidation.LocalValidatorFactoryBean)5 Optional (java.util.Optional)4 RequestMappingHandlerAdapter (org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter)4 SynthesizingMethodParameter (org.springframework.core.annotation.SynthesizingMethodParameter)3 ConversionService (org.springframework.core.convert.ConversionService)3 RequestParam (org.springframework.web.bind.annotation.RequestParam)3 ServletWebRequest (org.springframework.web.context.request.ServletWebRequest)3 Method (java.lang.reflect.Method)2 HashMap (java.util.HashMap)2 DirectFieldAccessor (org.springframework.beans.DirectFieldAccessor)2 Bean (org.springframework.context.annotation.Bean)2