Skip to content

Commit 64baef9

Browse files
committed
Fix failing tests
Issue: SPR-10825
1 parent a514305 commit 64baef9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

spring-test-mvc/src/main/java/org/springframework/test/web/servlet/setup/StandaloneMockMvcBuilder.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,9 @@ private void registerMvcSingletons(StubWebApplicationContext cxt) {
318318

319319
StandaloneConfiguration config = new StandaloneConfiguration();
320320

321-
StaticRequestMappingHandlerMapping hm = config.getHandlerMapping(cxt);
321+
StaticRequestMappingHandlerMapping hm = config.getHandlerMapping();
322+
hm.setServletContext(cxt.getServletContext());
323+
hm.setApplicationContext(cxt);
322324
hm.registerHandlers(controllers);
323325
cxt.addBean("requestMappingHandlerMapping", hm);
324326

@@ -358,11 +360,8 @@ private List<ViewResolver> initViewResolvers(WebApplicationContext wac) {
358360
private class StandaloneConfiguration extends WebMvcConfigurationSupport {
359361

360362

361-
public StaticRequestMappingHandlerMapping getHandlerMapping(StubWebApplicationContext cxt) {
362-
363+
public StaticRequestMappingHandlerMapping getHandlerMapping() {
363364
StaticRequestMappingHandlerMapping handlerMapping = new StaticRequestMappingHandlerMapping();
364-
handlerMapping.setServletContext(cxt.getServletContext());
365-
handlerMapping.setApplicationContext(cxt);
366365
handlerMapping.setEmbeddedValueResolver(new StaticStringValueResolver(placeHolderValues));
367366
handlerMapping.setUseSuffixPatternMatch(useSuffixPatternMatch);
368367
handlerMapping.setUseTrailingSlashMatch(useTrailingSlashPatternMatch);

0 commit comments

Comments
 (0)