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 WebClientBuilder
builder()
Create a newWebClientBuilder
.protected WebClient.Builder
Create theWebClient.Builder
to use.customizers
(WebClientCustomizer... customizer) Add theWebClientCustomizers
that 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 theVaultEndpoint
that should be used with theWebClient
.Set theReactiveVaultEndpointProvider
that should be used with theWebClient
.endpointProvider
(VaultEndpointProvider provider) Set theVaultEndpointProvider
that should be used with theWebClient
.filter
(ExchangeFilterFunction... filterFunctions) Add theExchangeFilterFunctions
that should be applied to theClientRequest
.httpConnector
(ClientHttpConnector httpConnector) Set theClientHttpConnector
that should be used with theWebClient
.httpConnectorFactory
(Supplier<ClientHttpConnector> httpConnector) Set theSupplier
ofClientHttpConnector
that should be called each time webuild()
a newWebClient
instance.
-
Method Details
-
builder
Create a newWebClientBuilder
.- Returns:
- a new
WebClientBuilder
.
-
endpoint
Set theVaultEndpoint
that should be used with theWebClient
.- Parameters:
endpoint
- theVaultEndpoint
provider.- Returns:
this
WebClientBuilder
.
-
endpointProvider
Set theVaultEndpointProvider
that should be used with theWebClient
.VaultEndpointProvider.getVaultEndpoint()
is called ona dedicated Thread
to ensure that I/O threads are never blocked.- Parameters:
provider
- theVaultEndpoint
provider.- Returns:
this
WebClientBuilder
.
-
endpointProvider
Set theReactiveVaultEndpointProvider
that should be used with theWebClient
.- Parameters:
provider
- theVaultEndpoint
provider.- Returns:
this
WebClientBuilder
.
-
httpConnector
Set theClientHttpConnector
that should be used with theWebClient
.- Parameters:
httpConnector
- the HTTP connector.- Returns:
this
WebClientBuilder
.
-
httpConnectorFactory
Set theSupplier
ofClientHttpConnector
that should be called each time webuild()
a newWebClient
instance.- Parameters:
httpConnector
- the supplier for the HTTP connector.- Returns:
this
WebClientBuilder
.- 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:
this
WebClientBuilder
.
-
customizers
Add theWebClientCustomizers
that should be applied to theWebClient
. Customizers are applied in the order that they were added.- Parameters:
customizer
- the client customizers to add.- Returns:
this
WebClientBuilder
.
-
filter
Add theExchangeFilterFunctions
that should be applied to theClientRequest
.ExchangeFilterFunction
s are applied in the order that they were added.- Parameters:
filterFunctions
- the request customizers to add.- Returns:
this
WebClientBuilder
.
-
build
Build a newWebClient
.VaultEndpoint
must be set. Applies alsoExchangeFilterFunction
andWebClientCustomizer
if configured.- Returns:
- a new
WebClient
.
-
createWebClientBuilder
Create theWebClient.Builder
to use.- Returns:
- the
WebClient.Builder
to use.
-