接口 MockMvcConfigurer
- 所有已知实现类:
MockMvcConfigurerAdapter
public interface MockMvcConfigurer
Allows a sub-class to encapsulate logic for pre-configuring aConfigurableMockMvcBuilderfor some specific purpose. A 3rd party library may use this to provide shortcuts for setting up MockMvc.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.:MockMvcBuilders.webAppContextSetup(context).apply(mySetup("foo","bar")).build();- 从以下版本开始:
- 4.1
- 作者:
- Rossen Stoyanchev
- 另请参阅:
MockMvcConfigurerAdapter
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 voidafterConfigurerAdded(ConfigurableMockMvcBuilder<?> builder)Invoked immediately after aMockMvcConfigureris added viaConfigurableMockMvcBuilder.apply(org.springframework.test.web.servlet.setup.MockMvcConfigurer).RequestPostProcessorbeforeMockMvcCreated(ConfigurableMockMvcBuilder<?> builder, WebApplicationContext context)Invoked just before the MockMvc instance is created.
方法详细资料
afterConfigurerAdded
void afterConfigurerAdded(ConfigurableMockMvcBuilder<?> builder)
Invoked immediately after aMockMvcConfigureris added viaConfigurableMockMvcBuilder.apply(org.springframework.test.web.servlet.setup.MockMvcConfigurer).
beforeMockMvcCreated
RequestPostProcessor beforeMockMvcCreated(ConfigurableMockMvcBuilder<?> builder, WebApplicationContext context)
Invoked just before the MockMvc instance is created. Implementations may return a RequestPostProcessor to be applied to every request performed through the createdMockMvcinstance.