DATACMNS-1237 - Register additional ProxyingHandlerMethodArgumentResolver as first resolver.
We now deploy a custom BeanPostProcessor to customize RequestMappingHandlerAdapter instances by prepending a ProxyingHandlerMethodArgumentResolver (requiring a @ModelAttribute) to the list of resolved HandlerMethodArgumentResolvers to make sure the settings defined in the annotation are applied but the projecting way of data binding is still used.
This commit is contained in:
@@ -35,7 +35,7 @@ import org.springframework.data.web.ProjectingJackson2HttpMessageConverterUnitTe
|
||||
public class ProxyingHandlerMethodArgumentResolverUnitTests {
|
||||
|
||||
ProxyingHandlerMethodArgumentResolver resolver = new ProxyingHandlerMethodArgumentResolver(
|
||||
new DefaultConversionService());
|
||||
() -> new DefaultConversionService(), true);
|
||||
|
||||
@Test // DATACMNS-776
|
||||
public void supportAnnotatedInterface() throws Exception {
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.springframework.data.geo.Distance;
|
||||
import org.springframework.data.geo.Point;
|
||||
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
|
||||
import org.springframework.data.web.PagedResourcesAssemblerArgumentResolver;
|
||||
import org.springframework.data.web.ProxyingHandlerMethodArgumentResolver;
|
||||
import org.springframework.data.web.SortHandlerMethodArgumentResolver;
|
||||
import org.springframework.data.web.WebTestUtils;
|
||||
import org.springframework.hateoas.Link;
|
||||
@@ -204,6 +205,16 @@ public class EnableSpringDataWebSupportIntegrationTests {
|
||||
assertThat((String) ReflectionTestUtils.getField(resolver, "sortParameter")).isEqualTo("foo");
|
||||
}
|
||||
|
||||
@Test // DATACMNS-1237
|
||||
public void configuresProxyingHandlerMethodArgumentResolver() {
|
||||
|
||||
ApplicationContext context = WebTestUtils.createApplicationContext(SampleConfig.class);
|
||||
|
||||
RequestMappingHandlerAdapter adapter = context.getBean(RequestMappingHandlerAdapter.class);
|
||||
|
||||
assertThat(adapter.getArgumentResolvers().get(0)).isInstanceOf(ProxyingHandlerMethodArgumentResolver.class);
|
||||
}
|
||||
|
||||
private static void assertResolversRegistered(ApplicationContext context, Class<?>... resolverTypes) {
|
||||
|
||||
RequestMappingHandlerAdapter adapter = context.getBean(RequestMappingHandlerAdapter.class);
|
||||
|
||||
Reference in New Issue
Block a user