在设置实例时,您可以注册一个或多个 Servlet 实例,如下例所示:MockMvc
Filter
-
Java
-
Kotlin
mockMvc = standaloneSetup(new PersonController()).addFilters(new CharacterEncodingFilter()).build();
// Not possible in Kotlin until {kotlin-issues}/KT-22208 is fixed
已注册的过滤器通过 from 调用,而
last 过滤器将 .MockFilterChain
spring-test
DispatcherServlet