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 ofAbstractMockMvcBuilderthat provides theWebApplicationContextsupplied to it as a constructor argument.In addition, if the
ServletContextin the suppliedWebApplicationContextdoes not contain an entry for theWebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTEkey, the rootWebApplicationContextwill be detected and stored in theServletContextunder theROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTEkey.- Since:
- 3.2
- Author:
- Rossen Stoyanchev, Rob Winch, Sam Brannen
Constructor Summary
Constructors Modifier Constructor Description protectedDefaultMockMvcBuilder(WebApplicationContext webAppContext)Protected constructor.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected WebApplicationContextinitWebAppContext()A method to obtain theWebApplicationContextto be passed to theDispatcherServlet.Methods inherited from class org.springframework.test.web.servlet.setup.AbstractMockMvcBuilder
addDispatcherServletCustomizer, addFilter, addFilters, alwaysDo, alwaysExpect, apply, build, defaultRequest, dispatchOptions, self
Methods inherited from class org.springframework.test.web.servlet.MockMvcBuilderSupport
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:AbstractMockMvcBuilderA method to obtain theWebApplicationContextto be passed to theDispatcherServlet. Invoked fromAbstractMockMvcBuilder.build()before theMockMvcinstance is created.- Specified by:
initWebAppContextin classAbstractMockMvcBuilder<DefaultMockMvcBuilder>