-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: taskA general taskA general task
Milestone
Description
Oliver Drotbohm opened SPR-10565 and commented
Assume you have to JavaConfig classes extending WebMvcConfigurationSupport, both overriding one of the callbacks of the parent class. Only the first one registered actually gets the callback invoked. See the following test case, the assertion fails with only one resolver registered.
@RunWith(MockitoJUnitRunner.class)
public class ConfigTest {
@Mock
static HandlerMethodArgumentResolver resolver;
@Configuration
static class FirstConfig extends WebMvcConfigurationSupport {
@Override
protected void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
argumentResolvers.add(resolver);
}
}
@Configuration
static class SecondConfig extends WebMvcConfigurationSupport {
@Override
protected void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
argumentResolvers.add(resolver);
}
}
@Test
public void foo() {
AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
context.setServletContext(new MockServletContext());
context.register(FirstConfig.class);
context.register(SecondConfig.class);
context.refresh();
RequestMappingHandlerAdapter adapter = context.getBean(RequestMappingHandlerAdapter.class);
assertThat(adapter.getCustomArgumentResolvers().size(), is(2));
}
}Affects: 3.2.2
0 votes, 5 watchers
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: taskA general taskA general task