|
This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Framework 7.0.1! |
Filter Registrations
When setting up a MockMvc instance, you can register one or more Servlet Filter
instances, as the following example shows:
-
Java
-
Kotlin
mockMvc = standaloneSetup(new PersonController()).addFilters(new CharacterEncodingFilter()).build();
mockMvc = standaloneSetup(PersonController()).addFilters<StandaloneMockMvcBuilder>(CharacterEncodingFilter()).build()
Registered filters are invoked through the MockFilterChain from spring-test, and the
last filter delegates to the DispatcherServlet.