接口 MockServerConfigurer
public interface MockServerConfigurer
Contract that frameworks or applications can use to pre-package a set of customizations to aWebTestClient.MockServerSpec
and expose that as a shortcut.An implementation of this interface can be plugged in via
WebTestClient.MockServerSpec.apply(org.springframework.test.web.reactive.server.MockServerConfigurer)
where instances are likely obtained via static methods, e.g.:import static org.example.ExampleSetup.securitySetup; // ... WebTestClient.bindToController(new TestController()) .apply(securitySetup("foo","bar")) .build();
- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev
- 另请参阅:
WebTestClientConfigurer
方法概要
所有方法 实例方法 默认方法 修饰符和类型 方法 说明 default void
afterConfigureAdded(WebTestClient.MockServerSpec<?> serverSpec)
Invoked immediately, i.e. before this method returns.default void
beforeServerCreated(WebHttpHandlerBuilder builder)
Invoked just before the mock server is built.
方法详细资料
afterConfigureAdded
default void afterConfigureAdded(WebTestClient.MockServerSpec<?> serverSpec)
Invoked immediately, i.e. before this method returns.- 参数:
serverSpec
- the serverSpec to which the configurer is added
beforeServerCreated
default void beforeServerCreated(WebHttpHandlerBuilder builder)
Invoked just before the mock server is built. Use this hook to inspect and/or modify application-declared filters and exception handlers.- 参数:
builder
- the builder for theHttpHandler
that will handle requests (i.e. the mock server)