Package org.springframework.vault.client
Class WebClientBuilder
java.lang.Object
org.springframework.vault.client.WebClientBuilder
Builder that can be used to configure and create a
WebClient. Provides
convenience methods to configure ClientHttpConnector and default headers.
By default the built WebClient will attempt to use the most suitable
ClientHttpConnector using ClientHttpConnectorFactory.create(org.springframework.vault.support.ClientOptions, org.springframework.vault.support.SslConfiguration).- Since:
- 2.2
- Author:
- Mark Paluch
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Build a newWebClient.static WebClientBuilderbuilder()Create a newWebClientBuilder.protected WebClient.BuilderCreate theWebClient.Builderto use.customizers(WebClientCustomizer... customizer) Add theWebClientCustomizersthat should be applied to theWebClient.defaultHeader(String name, String value) Add a default header that will be set if not already present on the outgoingHttpRequest.endpoint(VaultEndpoint endpoint) Set theVaultEndpointthat should be used with theWebClient.Set theReactiveVaultEndpointProviderthat should be used with theWebClient.endpointProvider(VaultEndpointProvider provider) Set theVaultEndpointProviderthat should be used with theWebClient.filter(ExchangeFilterFunction... filterFunctions) Add theExchangeFilterFunctionsthat should be applied to theClientRequest.httpConnector(ClientHttpConnector httpConnector) Set theClientHttpConnectorthat should be used with theWebClient.httpConnectorFactory(Supplier<ClientHttpConnector> httpConnector) Set theSupplierofClientHttpConnectorthat should be called each time webuild()a newWebClientinstance.
-
Method Details
-
builder
Create a newWebClientBuilder.- Returns:
- a new
WebClientBuilder.
-
endpoint
Set theVaultEndpointthat should be used with theWebClient.- Parameters:
endpoint- theVaultEndpointprovider.- Returns:
thisWebClientBuilder.
-
endpointProvider
Set theVaultEndpointProviderthat should be used with theWebClient.VaultEndpointProvider.getVaultEndpoint()is called ona dedicated Threadto ensure that I/O threads are never blocked.- Parameters:
provider- theVaultEndpointprovider.- Returns:
thisWebClientBuilder.
-
endpointProvider
Set theReactiveVaultEndpointProviderthat should be used with theWebClient.- Parameters:
provider- theVaultEndpointprovider.- Returns:
thisWebClientBuilder.
-
httpConnector
Set theClientHttpConnectorthat should be used with theWebClient.- Parameters:
httpConnector- the HTTP connector.- Returns:
thisWebClientBuilder.
-
httpConnectorFactory
Set theSupplierofClientHttpConnectorthat should be called each time webuild()a newWebClientinstance.- Parameters:
httpConnector- the supplier for the HTTP connector.- Returns:
thisWebClientBuilder.- Since:
- 2.2.1
-
defaultHeader
Add a default header that will be set if not already present on the outgoingHttpRequest.- Parameters:
name- the name of the header.value- the header value.- Returns:
thisWebClientBuilder.
-
customizers
Add theWebClientCustomizersthat should be applied to theWebClient. Customizers are applied in the order that they were added.- Parameters:
customizer- the client customizers to add.- Returns:
thisWebClientBuilder.
-
filter
Add theExchangeFilterFunctionsthat should be applied to theClientRequest.ExchangeFilterFunctions are applied in the order that they were added.- Parameters:
filterFunctions- the request customizers to add.- Returns:
thisWebClientBuilder.
-
build
Build a newWebClient.VaultEndpointmust be set. Applies alsoExchangeFilterFunctionandWebClientCustomizerif configured.- Returns:
- a new
WebClient.
-
createWebClientBuilder
Create theWebClient.Builderto use.- Returns:
- the
WebClient.Builderto use.
-