Class UserWebTestClientConfigurer
java.lang.Object
org.springframework.test.web.reactive.server.UserWebTestClientConfigurer
- All Implemented Interfaces:
- WebTestClientConfigurer
WebTestClientConfigurer that modifies WebFlux mock server requests
 by setting their SslInfo.
 You can apply the configurer to a WebTestClient.Builder:
 
 WebTestClient client = webTestClientBuilder
         .apply(UserWebTestClientConfigurer.x509(certificate))
         .build();
 
 Or mutate an already built WebTestClient:
 
 WebTestClient newClient =
         client.mutateWith(UserWebTestClientConfigurer.x509(certificate));
 
 Note: This configurer is applicable only to WebFlux mock
 server setup. For a WebTestClient.Builder with a live server setup,
 or a non-WebFlux, mock server, an IllegalStateException is raised.
 
For tests with a MockMvc server, refer to a similar facility to set the
 user identity per request through Spring Security's
 SecurityMockMvcRequestPostProcessors.
- Since:
- 7.0
- Author:
- Rossen Stoyanchev
- 
Method SummaryModifier and TypeMethodDescriptionvoidafterConfigurerAdded(WebTestClient.Builder builder, @Nullable WebHttpHandlerBuilder httpHandlerBuilder, @Nullable ClientHttpConnector connector) Use methods onWebTestClient.Builderto modify test client settings.static UserWebTestClientConfigurerCreate a configurer with the givenSslInfo.static UserWebTestClientConfigurerx509(X509Certificate... certificates) Create a configurer with the givenX509 certificate(s).
- 
Method Details- 
afterConfigurerAddedpublic void afterConfigurerAdded(WebTestClient.Builder builder, @Nullable WebHttpHandlerBuilder httpHandlerBuilder, @Nullable ClientHttpConnector connector) Description copied from interface:WebTestClientConfigurerUse methods onWebTestClient.Builderto modify test client settings. For a mock WebFlux server, useWebHttpHandlerBuilderto customize server configuration. For a MockMvc server, mutate theMockMvcHttpConnectorand set it onWebTestClient.Builder.- Specified by:
- afterConfigurerAddedin interface- WebTestClientConfigurer
- Parameters:
- builder- the WebTestClient builder for test client changes
- httpHandlerBuilder- for mock WebFlux server settings
- connector- the connector in use
 
- 
x509Create a configurer with the givenX509 certificate(s).
- 
sslInfoCreate a configurer with the givenSslInfo.
 
-