接口 MockMvcConfigurer
public interface MockMvcConfigurer
Contract for customizing a
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(cn.taketoday.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();
- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev
- 另请参阅:
-
方法概要
修饰符和类型方法说明default voidafterConfigurerAdded(ConfigurableMockMvcBuilder<?> builder) Invoked immediately when thisMockMvcConfigureris added viaConfigurableMockMvcBuilder.apply(cn.taketoday.test.web.servlet.setup.MockMvcConfigurer).default RequestPostProcessorbeforeMockMvcCreated(ConfigurableMockMvcBuilder<?> builder, cn.taketoday.web.servlet.WebApplicationContext context) Invoked when the MockMvc instance is about to be created with the MockMvc builder and the Infra WebApplicationContext that will be passed to theDispatcherServlet.
-
方法详细资料
-
afterConfigurerAdded
Invoked immediately when thisMockMvcConfigureris added viaConfigurableMockMvcBuilder.apply(cn.taketoday.test.web.servlet.setup.MockMvcConfigurer).- 参数:
builder- the builder for the MockMvc
-
beforeMockMvcCreated
@Nullable default RequestPostProcessor beforeMockMvcCreated(ConfigurableMockMvcBuilder<?> builder, cn.taketoday.web.servlet.WebApplicationContext context) Invoked when the MockMvc instance is about to be created with the MockMvc builder and the Infra WebApplicationContext that will be passed to theDispatcherServlet.- 参数:
builder- the builder for the MockMvccontext- the Infra configuration- 返回:
- a post processor to be applied to every request performed
through the
MockMvcinstance.
-