Skip to content

Commit 5e4f3b3

Browse files
committed
Cannot amend properties in RequestMappingHandlerMapping (e.g. useSuffixPatternMatch) using a bean post processor as ApplicationContextAwareProcessor always fires first initialising RequestMappingHandlerMapping
Issue: SPR-9371
1 parent c879894 commit 5e4f3b3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupportTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public void requestMappingHandlerMapping() throws Exception {
8383
assertEquals(0, handlerMapping.getOrder());
8484

8585
handlerMapping.setApplicationContext(cxt);
86+
handlerMapping.afterPropertiesSet();
8687
HandlerExecutionChain chain = handlerMapping.getHandler(new MockHttpServletRequest("GET", "/"));
8788
assertNotNull(chain.getInterceptors());
8889
assertEquals(ConversionServiceExposingInterceptor.class, chain.getInterceptors()[0].getClass());
@@ -167,7 +168,6 @@ public void handlerExceptionResolver() throws Exception {
167168

168169
@Test
169170
public void webMvcConfigurerExtensionHooks() throws Exception {
170-
171171
StaticWebApplicationContext appCxt = new StaticWebApplicationContext();
172172
appCxt.setServletContext(new MockServletContext(new FileSystemResourceLoader()));
173173
appCxt.registerSingleton("controller", TestController.class);
@@ -204,6 +204,7 @@ public void webMvcConfigurerExtensionHooks() throws Exception {
204204

205205
RequestMappingHandlerMapping rmHandlerMapping = webConfig.requestMappingHandlerMapping();
206206
rmHandlerMapping.setApplicationContext(appCxt);
207+
rmHandlerMapping.afterPropertiesSet();
207208
HandlerExecutionChain chain = rmHandlerMapping.getHandler(new MockHttpServletRequest("GET", "/"));
208209
assertNotNull(chain.getInterceptors());
209210
assertEquals(2, chain.getInterceptors().length);

0 commit comments

Comments
 (0)