Add protected method in StandaloneMockMvcBuilder
To allow sub-classes to register additional MVC infrastructure. Issue: SPR-17520
This commit is contained in:
@@ -399,6 +399,8 @@ public class StandaloneMockMvcBuilder extends AbstractMockMvcBuilder<StandaloneM
|
||||
|
||||
this.flashMapManager = new SessionFlashMapManager();
|
||||
wac.addBean(DispatcherServlet.FLASH_MAP_MANAGER_BEAN_NAME, this.flashMapManager);
|
||||
|
||||
extendMvcSingletons(sc).forEach(wac::addBean);
|
||||
}
|
||||
|
||||
private List<ViewResolver> initViewResolvers(WebApplicationContext wac) {
|
||||
@@ -412,6 +414,18 @@ public class StandaloneMockMvcBuilder extends AbstractMockMvcBuilder<StandaloneM
|
||||
return this.viewResolvers;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method could be used from a sub-class to register additional Spring
|
||||
* MVC infrastructure such as additional {@code HandlerMapping},
|
||||
* {@code HandlerAdapter}, and others.
|
||||
* @param servletContext the ServletContext
|
||||
* @return a map with additional MVC infrastructure object instances
|
||||
* @since 5.1.4
|
||||
*/
|
||||
protected Map<String, Object> extendMvcSingletons(@Nullable ServletContext servletContext) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
|
||||
/** Using the MVC Java configuration as the starting point for the "standalone" setup. */
|
||||
private class StandaloneConfiguration extends WebMvcConfigurationSupport {
|
||||
|
||||
Reference in New Issue
Block a user