Cannot amend properties in RequestMappingHandlerMapping (e.g. useSuffixPatternMatch) using a bean post processor as ApplicationContextAwareProcessor always fires first initialising RequestMappingHandlerMapping
Issue: SPR-9371
This commit is contained in:
@@ -83,6 +83,7 @@ public class WebMvcConfigurationSupportTests {
|
||||
assertEquals(0, handlerMapping.getOrder());
|
||||
|
||||
handlerMapping.setApplicationContext(cxt);
|
||||
handlerMapping.afterPropertiesSet();
|
||||
HandlerExecutionChain chain = handlerMapping.getHandler(new MockHttpServletRequest("GET", "/"));
|
||||
assertNotNull(chain.getInterceptors());
|
||||
assertEquals(ConversionServiceExposingInterceptor.class, chain.getInterceptors()[0].getClass());
|
||||
@@ -167,7 +168,6 @@ public class WebMvcConfigurationSupportTests {
|
||||
|
||||
@Test
|
||||
public void webMvcConfigurerExtensionHooks() throws Exception {
|
||||
|
||||
StaticWebApplicationContext appCxt = new StaticWebApplicationContext();
|
||||
appCxt.setServletContext(new MockServletContext(new FileSystemResourceLoader()));
|
||||
appCxt.registerSingleton("controller", TestController.class);
|
||||
@@ -204,6 +204,7 @@ public class WebMvcConfigurationSupportTests {
|
||||
|
||||
RequestMappingHandlerMapping rmHandlerMapping = webConfig.requestMappingHandlerMapping();
|
||||
rmHandlerMapping.setApplicationContext(appCxt);
|
||||
rmHandlerMapping.afterPropertiesSet();
|
||||
HandlerExecutionChain chain = rmHandlerMapping.getHandler(new MockHttpServletRequest("GET", "/"));
|
||||
assertNotNull(chain.getInterceptors());
|
||||
assertEquals(2, chain.getInterceptors().length);
|
||||
|
||||
Reference in New Issue
Block a user