public interface MockMvcConfigurer
ConfigurableMockMvcBuilder
in some
specific way, e.g. a 3rd party library that wants to provide shortcuts for
setting up a MockMvc.
An implementation of this interface can be plugged in via
ConfigurableMockMvcBuilder.apply(org.springframework.test.web.servlet.setup.MockMvcConfigurer)
with instances of this type likely
created via static methods, e.g.:
import static org.example.ExampleSetup.mySetup; // ... MockMvcBuilders.webAppContextSetup(context).apply(mySetup("foo","bar")).build();
MockMvcConfigurerAdapter
Modifier and Type | Method and Description |
---|---|
default void |
afterConfigurerAdded(ConfigurableMockMvcBuilder<?> builder)
Invoked immediately when this
MockMvcConfigurer is added via
ConfigurableMockMvcBuilder.apply(org.springframework.test.web.servlet.setup.MockMvcConfigurer) . |
default RequestPostProcessor |
beforeMockMvcCreated(ConfigurableMockMvcBuilder<?> builder,
WebApplicationContext context)
Invoked when the MockMvc instance is about to be created with the MockMvc
builder and the Spring WebApplicationContext that will be passed to the
DispatcherServlet . |
default void afterConfigurerAdded(ConfigurableMockMvcBuilder<?> builder)
MockMvcConfigurer
is added via
ConfigurableMockMvcBuilder.apply(org.springframework.test.web.servlet.setup.MockMvcConfigurer)
.builder
- the builder for the MockMvc@Nullable default RequestPostProcessor beforeMockMvcCreated(ConfigurableMockMvcBuilder<?> builder, WebApplicationContext context)
DispatcherServlet
.builder
- the builder for the MockMvccontext
- the Spring configurationMockMvc
instance.