Java Code Examples for org.springframework.http.client.reactive.ClientHttpConnector

The following examples show how to use org.springframework.http.client.reactive.ClientHttpConnector. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: spring-analysis-note   Source File: WiretapConnectorTests.java    License: MIT License 6 votes vote down vote up
@Test
public void captureAndClaim() {
	ClientHttpRequest request = new MockClientHttpRequest(HttpMethod.GET, "/test");
	ClientHttpResponse response = new MockClientHttpResponse(HttpStatus.OK);
	ClientHttpConnector connector = (method, uri, fn) -> fn.apply(request).then(Mono.just(response));

	ClientRequest clientRequest = ClientRequest.create(HttpMethod.GET, URI.create("/test"))
			.header(WebTestClient.WEBTESTCLIENT_REQUEST_ID, "1").build();

	WiretapConnector wiretapConnector = new WiretapConnector(connector);
	ExchangeFunction function = ExchangeFunctions.create(wiretapConnector);
	function.exchange(clientRequest).block(ofMillis(0));

	WiretapConnector.Info actual = wiretapConnector.claimRequest("1");
	ExchangeResult result = actual.createExchangeResult(Duration.ZERO, null);
	assertEquals(HttpMethod.GET, result.getMethod());
	assertEquals("/test", result.getUrl().toString());
}
 
Example 2
Source Project: java-technology-stack   Source File: WiretapConnectorTests.java    License: MIT License 6 votes vote down vote up
@Test
public void captureAndClaim() {
	ClientHttpRequest request = new MockClientHttpRequest(HttpMethod.GET, "/test");
	ClientHttpResponse response = new MockClientHttpResponse(HttpStatus.OK);
	ClientHttpConnector connector = (method, uri, fn) -> fn.apply(request).then(Mono.just(response));

	ClientRequest clientRequest = ClientRequest.create(HttpMethod.GET, URI.create("/test"))
			.header(WebTestClient.WEBTESTCLIENT_REQUEST_ID, "1").build();

	WiretapConnector wiretapConnector = new WiretapConnector(connector);
	ExchangeFunction function = ExchangeFunctions.create(wiretapConnector);
	function.exchange(clientRequest).block(ofMillis(0));

	WiretapConnector.Info actual = wiretapConnector.claimRequest("1");
	ExchangeResult result = actual.createExchangeResult(Duration.ZERO, null);
	assertEquals(HttpMethod.GET, result.getMethod());
	assertEquals("/test", result.getUrl().toString());
}
 
Example 3
Source Project: spring-vault   Source File: ClientHttpConnectorFactory.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Create a {@link ClientHttpConnector} for the given {@link ClientOptions} and
 * {@link SslConfiguration}.
 * @param options must not be {@literal null}
 * @param sslConfiguration must not be {@literal null}
 * @return a new {@link ClientHttpConnector}.
 */
public static ClientHttpConnector create(ClientOptions options, SslConfiguration sslConfiguration) {

	Assert.notNull(options, "ClientOptions must not be null");
	Assert.notNull(sslConfiguration, "SslConfiguration must not be null");

	if (REACTOR_NETTY_PRESENT) {
		return ReactorNetty.usingReactorNetty(options, sslConfiguration);
	}

	if (JETTY_PRESENT) {
		return JettyClient.usingJetty(options, sslConfiguration);
	}

	throw new IllegalStateException("No supported Reactive Http Client library available (Reactor Netty, Jetty)");
}
 
Example 4
Source Project: spring-vault   Source File: ClientHttpConnectorFactory.java    License: Apache License 2.0 6 votes vote down vote up
static ClientHttpConnector usingReactorNetty(ClientOptions options, SslConfiguration sslConfiguration) {
	HttpClient client = HttpClient.create();

	if (hasSslConfiguration(sslConfiguration)) {

		SslContextBuilder sslContextBuilder = SslContextBuilder.forClient();
		configureSsl(sslConfiguration, sslContextBuilder);

		client = client.secure(builder -> {
			builder.sslContext(sslContextBuilder);
		});
	}

	client = client.tcpConfiguration(it -> it.option(ChannelOption.CONNECT_TIMEOUT_MILLIS,
			Math.toIntExact(options.getConnectionTimeout().toMillis())));

	return new ReactorClientHttpConnector(client);
}
 
Example 5
@Test
void justLoginRequestShouldLogin() {

	ClientHttpRequest request = new MockClientHttpRequest(HttpMethod.POST, "/auth/cert/login");
	MockClientHttpResponse response = new MockClientHttpResponse(HttpStatus.OK);
	response.getHeaders().setContentType(MediaType.APPLICATION_JSON);
	response.setBody(
			"{" + "\"auth\":{\"client_token\":\"my-token\", \"renewable\": true, \"lease_duration\": 10}" + "}");
	ClientHttpConnector connector = (method, uri, fn) -> fn.apply(request).then(Mono.just(response));

	WebClient webClient = WebClient.builder().clientConnector(connector).build();

	AuthenticationSteps steps = AuthenticationSteps
			.just(post("/auth/{path}/login", "cert").as(VaultResponse.class));

	login(steps, webClient).as(StepVerifier::create) //
			.expectNext(VaultToken.of("my-token")) //
			.verifyComplete();
}
 
Example 6
@Test
void justLoginShouldFail() {

	ClientHttpRequest request = new MockClientHttpRequest(HttpMethod.POST, "/auth/cert/login");
	MockClientHttpResponse response = new MockClientHttpResponse(HttpStatus.BAD_REQUEST);
	ClientHttpConnector connector = (method, uri, fn) -> fn.apply(request).then(Mono.just(response));

	WebClient webClient = WebClient.builder().clientConnector(connector).build();

	AuthenticationSteps steps = AuthenticationSteps
			.just(post("/auth/{path}/login", "cert").as(VaultResponse.class));

	login(steps, webClient).as(StepVerifier::create) //
			.expectError() //
			.verify();
}
 
Example 7
@Test
void shouldApplyNamespace() {

	ClientHttpRequest request = new MockClientHttpRequest(HttpMethod.POST, "/auth/foo");
	MockClientHttpResponse response = new MockClientHttpResponse(HttpStatus.OK);

	ClientHttpConnector connector = (method, uri, fn) -> fn.apply(request).then(Mono.just(response));

	WebClient webClient = WebClient.builder().clientConnector(connector)
			.filter(ReactiveVaultClients.namespace("foo/bar")).build();

	webClient.get().uri("/auth/foo").retrieve().bodyToMono(String.class).as(StepVerifier::create) //
			.verifyComplete();

	assertThat(request.getHeaders()).containsEntry(VaultHttpHeaders.VAULT_NAMESPACE,
			Collections.singletonList("foo/bar"));
}
 
Example 8
@Test
void shouldAllowNamespaceOverride() {

	ClientHttpRequest request = new MockClientHttpRequest(HttpMethod.POST, "/auth/foo");
	MockClientHttpResponse response = new MockClientHttpResponse(HttpStatus.OK);

	ClientHttpConnector connector = (method, uri, fn) -> fn.apply(request).then(Mono.just(response));

	WebClient webClient = WebClient.builder().clientConnector(connector)
			.filter(ReactiveVaultClients.namespace("foo/bar")).build();

	webClient.get().uri("/auth/foo").header(VaultHttpHeaders.VAULT_NAMESPACE, "baz").retrieve()
			.bodyToMono(String.class) //
			.as(StepVerifier::create) //
			.verifyComplete();

	assertThat(request.getHeaders()).containsEntry(VaultHttpHeaders.VAULT_NAMESPACE,
			Collections.singletonList("baz"));
}
 
Example 9
Source Project: tutorials   Source File: SpringWebFluxUnitTest.java    License: MIT License 6 votes vote down vote up
@Test
public void givenReactiveClient_whenRequested_shouldReturnResponse() throws Exception {
    
    HttpClient httpClient = new HttpClient();
    httpClient.start();

    ClientHttpConnector clientConnector = new JettyClientHttpConnector(httpClient);
    WebClient client = WebClient.builder()
        .clientConnector(clientConnector)
        .build();
    String responseContent = client.post()
        .uri(uri())
        .contentType(MediaType.TEXT_PLAIN)
        .body(BodyInserters.fromPublisher(Mono.just(CONTENT), String.class))
        .retrieve()
        .bodyToMono(String.class)
        .block();
    Assert.assertNotNull(responseContent);
    Assert.assertEquals(CONTENT, responseContent);
}
 
Example 10
Source Project: spring-analysis-note   Source File: ExchangeFunctions.java    License: MIT License 5 votes vote down vote up
public DefaultExchangeFunction(ClientHttpConnector connector, ExchangeStrategies strategies) {
	Assert.notNull(connector, "ClientHttpConnector must not be null");
	Assert.notNull(strategies, "ExchangeStrategies must not be null");
	this.connector = connector;
	this.strategies = strategies;

	strategies.messageWriters().stream()
			.filter(LoggingCodecSupport.class::isInstance)
			.forEach(reader -> {
				if (((LoggingCodecSupport) reader).isEnableLoggingRequestDetails()) {
					this.enableLoggingRequestDetails = true;
				}
			});
}
 
Example 11
Source Project: spring-analysis-note   Source File: DefaultWebTestClientBuilder.java    License: MIT License 5 votes vote down vote up
private DefaultWebTestClientBuilder(@Nullable WebClient.Builder webClientBuilder,
		@Nullable WebHttpHandlerBuilder httpHandlerBuilder, @Nullable ClientHttpConnector connector,
		@Nullable Duration responseTimeout) {

	Assert.isTrue(httpHandlerBuilder != null || connector != null,
			"Either WebHttpHandlerBuilder or ClientHttpConnector must be provided");

	this.webClientBuilder = (webClientBuilder != null ? webClientBuilder : WebClient.builder());
	this.httpHandlerBuilder = (httpHandlerBuilder != null ? httpHandlerBuilder.clone() : null);
	this.connector = connector;
	this.responseTimeout = responseTimeout;
}
 
Example 12
Source Project: spring-analysis-note   Source File: DefaultWebTestClientBuilder.java    License: MIT License 5 votes vote down vote up
@Override
public WebTestClient build() {
	ClientHttpConnector connectorToUse = this.connector;
	if (connectorToUse == null) {
		Assert.state(this.httpHandlerBuilder != null, "No WebHttpHandlerBuilder available");
		connectorToUse = new HttpHandlerConnector(this.httpHandlerBuilder.build());
	}

	return new DefaultWebTestClient(this.webClientBuilder,
			connectorToUse, this.responseTimeout, new DefaultWebTestClientBuilder(this));
}
 
Example 13
Source Project: spring-analysis-note   Source File: DefaultWebTestClient.java    License: MIT License 5 votes vote down vote up
DefaultWebTestClient(WebClient.Builder clientBuilder, ClientHttpConnector connector,
		@Nullable Duration timeout, DefaultWebTestClientBuilder webTestClientBuilder) {

	Assert.notNull(clientBuilder, "WebClient.Builder is required");
	this.wiretapConnector = new WiretapConnector(connector);
	this.webClient = clientBuilder.clientConnector(this.wiretapConnector).build();
	this.timeout = (timeout != null ? timeout : Duration.ofSeconds(5));
	this.builder = webTestClientBuilder;
}
 
Example 14
Source Project: spring-analysis-note   Source File: ExchangeMutatorTests.java    License: MIT License 5 votes vote down vote up
@Override
public void afterConfigurerAdded(WebTestClient.Builder builder,
		@Nullable WebHttpHandlerBuilder httpHandlerBuilder,
		@Nullable ClientHttpConnector connector) {

	Assert.notNull(httpHandlerBuilder, "Not a mock server");
	httpHandlerBuilder.filters(filters -> {
		filters.removeIf(filter -> filter instanceof IdentityFilter);
		filters.add(0, this.filter);
	});
}
 
Example 15
Source Project: java-technology-stack   Source File: ExchangeFunctions.java    License: MIT License 5 votes vote down vote up
public DefaultExchangeFunction(ClientHttpConnector connector, ExchangeStrategies strategies) {
	Assert.notNull(connector, "ClientHttpConnector must not be null");
	Assert.notNull(strategies, "ExchangeStrategies must not be null");
	this.connector = connector;
	this.strategies = strategies;

	strategies.messageWriters().stream()
			.filter(LoggingCodecSupport.class::isInstance)
			.forEach(reader -> {
				if (((LoggingCodecSupport) reader).isEnableLoggingRequestDetails()) {
					this.enableLoggingRequestDetails = true;
				}
			});
}
 
Example 16
private DefaultWebTestClientBuilder(@Nullable WebClient.Builder webClientBuilder,
		@Nullable WebHttpHandlerBuilder httpHandlerBuilder, @Nullable ClientHttpConnector connector,
		@Nullable Duration responseTimeout) {

	Assert.isTrue(httpHandlerBuilder != null || connector != null,
			"Either WebHttpHandlerBuilder or ClientHttpConnector must be provided");

	this.webClientBuilder = (webClientBuilder != null ? webClientBuilder : WebClient.builder());
	this.httpHandlerBuilder = (httpHandlerBuilder != null ? httpHandlerBuilder.clone() : null);
	this.connector = connector;
	this.responseTimeout = responseTimeout;
}
 
Example 17
@Override
public WebTestClient build() {
	ClientHttpConnector connectorToUse = this.connector;
	if (connectorToUse == null) {
		Assert.state(this.httpHandlerBuilder != null, "No WebHttpHandlerBuilder available");
		connectorToUse = new HttpHandlerConnector(this.httpHandlerBuilder.build());
	}

	return new DefaultWebTestClient(this.webClientBuilder,
			connectorToUse, this.responseTimeout, new DefaultWebTestClientBuilder(this));
}
 
Example 18
Source Project: java-technology-stack   Source File: DefaultWebTestClient.java    License: MIT License 5 votes vote down vote up
DefaultWebTestClient(WebClient.Builder clientBuilder, ClientHttpConnector connector,
		@Nullable Duration timeout, DefaultWebTestClientBuilder webTestClientBuilder) {

	Assert.notNull(clientBuilder, "WebClient.Builder is required");
	this.wiretapConnector = new WiretapConnector(connector);
	this.webClient = clientBuilder.clientConnector(this.wiretapConnector).build();
	this.timeout = (timeout != null ? timeout : Duration.ofSeconds(5));
	this.builder = webTestClientBuilder;
}
 
Example 19
Source Project: java-technology-stack   Source File: ExchangeMutatorTests.java    License: MIT License 5 votes vote down vote up
@Override
public void afterConfigurerAdded(WebTestClient.Builder builder,
		@Nullable WebHttpHandlerBuilder httpHandlerBuilder,
		@Nullable ClientHttpConnector connector) {

	Assert.notNull(httpHandlerBuilder, "Not a mock server");
	httpHandlerBuilder.filters(filters -> {
		filters.removeIf(filter -> filter instanceof IdentityFilter);
		filters.add(0, this.filter);
	});
}
 
Example 20
@Test
public void webClientConnectorNotConfigured() {
	this.context.withClassLoader(new FilteredClassLoader(WebClient.class))
			.withPropertyValues("spring.credhub.url=https://localhost",
					"spring.credhub.oauth2.registration-id=test-client", "spring.credhub.connection-timeout=30",
					"spring.credhub.read-timeout=60")
			.run((context) -> assertThat(context).doesNotHaveBean(ClientHttpConnector.class));
}
 
Example 21
Source Project: spring-credhub   Source File: ClientHttpConnectorFactory.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create a {@link ClientHttpConnector} for the given {@link ClientOptions}.
 * @param options must not be {@literal null}
 * @return a new {@link ClientHttpConnector}.
 */
public static ClientHttpConnector create(ClientOptions options) {
	HttpClient httpClient = HttpClient.create();

	if (usingCustomCerts(options)) {
		TrustManagerFactory trustManagerFactory = sslCertificateUtils
				.createTrustManagerFactory(options.getCaCertFiles());

		httpClient = httpClient.secure((sslContextSpec) -> sslContextSpec.sslContext(
				SslContextBuilder.forClient().sslProvider(SslProvider.JDK).trustManager(trustManagerFactory)));
	}
	else {
		httpClient = httpClient.secure((sslContextSpec) -> {
			try {
				sslContextSpec.sslContext(new JdkSslContext(SSLContext.getDefault(), true, null,
						IdentityCipherSuiteFilter.INSTANCE, null, ClientAuth.REQUIRE, null, false));
			}
			catch (NoSuchAlgorithmException ex) {
				logger.error("Error configuring HTTP connections", ex);
				throw new RuntimeException("Error configuring HTTP connections", ex);
			}
		});
	}

	if (options.getConnectionTimeout() != null) {
		httpClient = httpClient
				.tcpConfiguration((tcpClient) -> tcpClient.option(ChannelOption.CONNECT_TIMEOUT_MILLIS,
						Math.toIntExact(options.getConnectionTimeout().toMillis())));
	}

	return new ReactorClientHttpConnector(httpClient);
}
 
Example 22
Source Project: spring-credhub   Source File: ReactiveCredHubTemplate.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create a new {@link ReactiveCredHubTemplate} using the provided base URI and
 * {@link ClientHttpRequestFactory}.
 * @param credHubProperties connection properties for the CredHub server
 * @param clientHttpConnector the {@link ClientHttpConnector} to use when creating new
 * connections
 */
public ReactiveCredHubTemplate(CredHubProperties credHubProperties, ClientHttpConnector clientHttpConnector) {
	Assert.notNull(credHubProperties, "credHubProperties must not be null");
	Assert.notNull(clientHttpConnector, "clientHttpConnector must not be null");

	this.webClient = CredHubWebClientFactory.createWebClient(credHubProperties, clientHttpConnector);
	this.usingOAuth2 = false;
}
 
Example 23
Source Project: spring-credhub   Source File: ReactiveCredHubTemplate.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create a new {@link ReactiveCredHubTemplate} using the provided base URI and
 * {@link ClientHttpRequestFactory}.
 * @param credHubProperties connection properties for the CredHub server
 * @param clientHttpConnector the {@link ClientHttpConnector} to use when creating new
 * connections
 * @param clientRegistrationRepository a repository of OAuth2 client registrations
 * @param authorizedClientRepository a repository of authorized OAuth2 clients
 */
public ReactiveCredHubTemplate(CredHubProperties credHubProperties, ClientHttpConnector clientHttpConnector,
		ReactiveClientRegistrationRepository clientRegistrationRepository,
		ServerOAuth2AuthorizedClientRepository authorizedClientRepository) {
	Assert.notNull(credHubProperties, "credHubProperties must not be null");
	Assert.notNull(clientHttpConnector, "clientHttpConnector must not be null");
	Assert.notNull(clientRegistrationRepository, "clientRegistrationRepository must not be null");
	Assert.notNull(authorizedClientRepository, "authorizedClientRepository must not be null");

	this.webClient = CredHubWebClientFactory.createWebClient(credHubProperties, clientHttpConnector,
			clientRegistrationRepository, authorizedClientRepository);
	this.usingOAuth2 = true;
}
 
Example 24
Source Project: spring-credhub   Source File: ReactiveCredHubTemplate.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create a new {@link ReactiveCredHubTemplate} using the provided base URI and
 * {@link ClientHttpRequestFactory}.
 * @param credHubProperties connection properties for the CredHub server
 * @param clientHttpConnector the {@link ClientHttpConnector} to use when creating new
 * connections
 * @param clientManager an OAuth2 authorization client manager
 */
public ReactiveCredHubTemplate(CredHubProperties credHubProperties, ClientHttpConnector clientHttpConnector,
		ReactiveOAuth2AuthorizedClientManager clientManager) {
	Assert.notNull(credHubProperties, "credHubProperties must not be null");
	Assert.notNull(clientHttpConnector, "clientHttpConnector must not be null");
	Assert.notNull(clientManager, "clientManager must not be null");

	this.webClient = CredHubWebClientFactory.createWebClient(credHubProperties, clientHttpConnector, clientManager);
	this.usingOAuth2 = true;
}
 
Example 25
Source Project: spring-credhub   Source File: CredHubWebClientFactory.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create a {@link WebClient} configured for communication with a CredHub server.
 * @param properties the CredHub connection properties
 * @param clientHttpConnector the {@link ClientHttpConnector} to use when creating new
 * connections
 * @param clientRegistrationRepository a repository of OAuth2 client registrations
 * @param authorizedClientRepository a repository of OAuth2 authorized clients
 * @return a configured {@link WebClient}
 */
static WebClient createWebClient(CredHubProperties properties, ClientHttpConnector clientHttpConnector,
		ReactiveClientRegistrationRepository clientRegistrationRepository,
		ServerOAuth2AuthorizedClientRepository authorizedClientRepository) {
	ReactiveOAuth2AuthorizedClientProvider clientProvider = buildClientProvider(clientHttpConnector);

	DefaultReactiveOAuth2AuthorizedClientManager defaultClientManager = buildClientManager(
			clientRegistrationRepository, authorizedClientRepository, clientProvider);

	return createWebClient(properties, clientHttpConnector, defaultClientManager);
}
 
Example 26
Source Project: spring-credhub   Source File: CredHubWebClientFactory.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create a {@link WebClient} configured for communication with a CredHub server.
 * @param properties the CredHub connection properties
 * @param clientHttpConnector the {@link ClientHttpConnector} to use when creating new
 * connections
 * @param clientManager an OAuth2 client manager to use to authenticate a client
 * @return a configured {@link WebClient}
 */
static WebClient createWebClient(CredHubProperties properties, ClientHttpConnector clientHttpConnector,
		ReactiveOAuth2AuthorizedClientManager clientManager) {

	ServerOAuth2AuthorizedClientExchangeFilterFunction oauth = new ServerOAuth2AuthorizedClientExchangeFilterFunction(
			clientManager);

	return buildWebClient(properties.getUrl(), clientHttpConnector).filter(oauth).defaultRequest(
			(requestHeadersSpec) -> requestHeadersSpec.attributes(ServerOAuth2AuthorizedClientExchangeFilterFunction
					.clientRegistrationId(properties.getOauth2().getRegistrationId())))
			.build();
}
 
Example 27
Source Project: spring-credhub   Source File: CredHubWebClientFactory.java    License: Apache License 2.0 5 votes vote down vote up
private static WebClient.Builder buildWebClient(String baseUri, ClientHttpConnector clientHttpConnector) {
	ExchangeStrategies strategies = ExchangeStrategies.builder().codecs((configurer) -> {
		ObjectMapper mapper = JsonUtils.buildObjectMapper();

		CodecConfigurer.DefaultCodecs dc = configurer.defaultCodecs();
		dc.jackson2JsonDecoder(new Jackson2JsonDecoder(mapper));
		dc.jackson2JsonEncoder(new Jackson2JsonEncoder(mapper));
	}).build();

	return WebClient.builder().clientConnector(clientHttpConnector).baseUrl(baseUri)
			.defaultHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE)
			.defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
			.exchangeStrategies(strategies);
}
 
Example 28
Source Project: spring-vault   Source File: WebClientBuilder.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Set the {@link Supplier} of {@link ClientHttpConnector} that should be called each
 * time we {@link #build()} a new {@link WebClient} instance.
 * @param httpConnector the supplier for the HTTP connector.
 * @return {@code this} {@link WebClientBuilder}.
 * @since 2.2.1
 */
public WebClientBuilder httpConnectorFactory(Supplier<ClientHttpConnector> httpConnector) {

	Assert.notNull(httpConnector, "Supplier of ClientHttpConnector must not be null");

	this.httpConnector = httpConnector;
	return this;
}
 
Example 29
Source Project: spring-vault   Source File: ClientHttpConnectorFactory.java    License: Apache License 2.0 5 votes vote down vote up
static ClientHttpConnector usingJetty(ClientOptions options, SslConfiguration sslConfiguration) {

			try {
				return new JettyClientHttpConnector(configureClient(getHttpClient(sslConfiguration), options));
			}
			catch (GeneralSecurityException | IOException e) {
				throw new IllegalStateException(e);
			}
		}
 
Example 30
/**
 * Create a {@link WebClientFactory} bean that is used to produce a {@link WebClient}.
 * @return the {@link WebClientFactory}.
 * @see #clientHttpConnector()
 * @since 2.3
 */
@Bean
public WebClientFactory webClientFactory() {

	ClientHttpConnector httpConnector = clientHttpConnector();

	return new DefaultWebClientFactory(httpConnector, clientHttpConnector -> {
		return webClientBuilder(reactiveVaultEndpointProvider(), clientHttpConnector);
	});
}