Class DefaultMockMvcBuilder
- java.lang.Object
- org.springframework.test.web.servlet.MockMvcBuilderSupport
- org.springframework.test.web.servlet.setup.AbstractMockMvcBuilder<DefaultMockMvcBuilder>
- org.springframework.test.web.servlet.setup.DefaultMockMvcBuilder
- All Implemented Interfaces:
MockMvcBuilder
,ConfigurableMockMvcBuilder<DefaultMockMvcBuilder>
public class DefaultMockMvcBuilder extends AbstractMockMvcBuilder<DefaultMockMvcBuilder>
A concrete implementation ofAbstractMockMvcBuilder
that provides theWebApplicationContext
supplied to it as a constructor argument.In addition, if the
ServletContext
in the suppliedWebApplicationContext
does not contain an entry for theWebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
key, the rootWebApplicationContext
will be detected and stored in theServletContext
under theROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
key.- Since:
- 3.2
- Author:
- Rossen Stoyanchev, Rob Winch, Sam Brannen
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultMockMvcBuilder(WebApplicationContext webAppContext)
Protected constructor.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected WebApplicationContext
initWebAppContext()
A method to obtain the WebApplicationContext to be passed to the DispatcherServlet.Methods inherited from class org.springframework.test.web.servlet.setup.AbstractMockMvcBuilder
addDispatcherServletCustomizer, addFilter, addFilters, alwaysDo, alwaysExpect, apply, build, defaultRequest, dispatchOptions
Methods inherited from class org.springframework.test.web.servlet.MockMvcBuilderSupport
createMockMvc, createMockMvc
Constructor Detail
DefaultMockMvcBuilder
protected DefaultMockMvcBuilder(WebApplicationContext webAppContext)
Protected constructor. Not intended for direct instantiation.
Method Detail
initWebAppContext
protected WebApplicationContext initWebAppContext()
Description copied from class:AbstractMockMvcBuilder
A method to obtain the WebApplicationContext to be passed to the DispatcherServlet. Invoked fromAbstractMockMvcBuilder.build()
before theMockMvc
instance is created.- Specified by:
initWebAppContext
in classAbstractMockMvcBuilder<DefaultMockMvcBuilder>