Interface 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();
- Since:
- 5.0
- Author:
- Rossen Stoyanchev
- See Also:
WebTestClientConfigurer
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default void
afterConfigureAdded(WebTestClient.MockServerSpec<?> serverSpec)
Invoked immediately, i.e.default void
beforeServerCreated(WebHttpHandlerBuilder builder)
Invoked just before the mock server is built.
Method Detail
afterConfigureAdded
default void afterConfigureAdded(WebTestClient.MockServerSpec<?> serverSpec)
Invoked immediately, i.e. before this method returns.- Parameters:
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.- Parameters:
builder
- the builder for theHttpHandler
that will handle requests (i.e. the mock server)