Remove old methods from configuration.

Original Pull Request #2513
Closes #2512
This commit is contained in:
Peter-Josef Meisch 2023-04-02 20:16:13 +02:00 committed by GitHub
parent 7f772703d3
commit a5fb7a3c76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 27 deletions

View File

@ -163,11 +163,6 @@ public interface ClientConfiguration {
*/ */
Optional<String> getProxy(); Optional<String> getProxy();
/**
* @return the function for configuring a WebClient.
*/
Function<WebClient, WebClient> getWebClientConfigurer();
/** /**
* @return the client configuration callbacks * @return the client configuration callbacks
* @since 4.3 * @since 4.3

View File

@ -59,7 +59,6 @@ class ClientConfigurationBuilder
private @Nullable String password; private @Nullable String password;
private @Nullable String pathPrefix; private @Nullable String pathPrefix;
private @Nullable String proxy; private @Nullable String proxy;
private final Function<WebClient, WebClient> webClientConfigurer = Function.identity();
private Supplier<HttpHeaders> headersSupplier = HttpHeaders::new; private Supplier<HttpHeaders> headersSupplier = HttpHeaders::new;
@Deprecated private final HttpClientConfigCallback httpClientConfigurer = httpClientBuilder -> httpClientBuilder; @Deprecated private final HttpClientConfigCallback httpClientConfigurer = httpClientBuilder -> httpClientBuilder;
private final List<ClientConfiguration.ClientConfigurationCallback<?>> clientConfigurers = new ArrayList<>(); private final List<ClientConfiguration.ClientConfigurationCallback<?>> clientConfigurers = new ArrayList<>();
@ -230,7 +229,7 @@ class ClientConfigurationBuilder
} }
return new DefaultClientConfiguration(hosts, headers, useSsl, sslContext, soTimeout, connectTimeout, pathPrefix, return new DefaultClientConfiguration(hosts, headers, useSsl, sslContext, soTimeout, connectTimeout, pathPrefix,
hostnameVerifier, proxy, webClientConfigurer, httpClientConfigurer, clientConfigurers, headersSupplier); hostnameVerifier, proxy, httpClientConfigurer, clientConfigurers, headersSupplier);
} }
private static InetSocketAddress parse(String hostAndPort) { private static InetSocketAddress parse(String hostAndPort) {

View File

@ -19,7 +19,6 @@ import java.net.InetSocketAddress;
import java.time.Duration; import java.time.Duration;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.function.Function;
import java.util.function.Supplier; import java.util.function.Supplier;
import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HostnameVerifier;
@ -28,7 +27,6 @@ import javax.net.ssl.SSLContext;
import org.elasticsearch.client.RestClientBuilder.HttpClientConfigCallback; import org.elasticsearch.client.RestClientBuilder.HttpClientConfigCallback;
import org.springframework.data.elasticsearch.support.HttpHeaders; import org.springframework.data.elasticsearch.support.HttpHeaders;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
import org.springframework.web.reactive.function.client.WebClient;
/** /**
* Default {@link ClientConfiguration} implementation. * Default {@link ClientConfiguration} implementation.
@ -50,7 +48,6 @@ class DefaultClientConfiguration implements ClientConfiguration {
private final @Nullable String pathPrefix; private final @Nullable String pathPrefix;
private final @Nullable HostnameVerifier hostnameVerifier; private final @Nullable HostnameVerifier hostnameVerifier;
private final @Nullable String proxy; private final @Nullable String proxy;
private final Function<WebClient, WebClient> webClientConfigurer;
private final HttpClientConfigCallback httpClientConfigurer; private final HttpClientConfigCallback httpClientConfigurer;
private final Supplier<HttpHeaders> headersSupplier; private final Supplier<HttpHeaders> headersSupplier;
private final List<ClientConfigurationCallback<?>> clientConfigurers; private final List<ClientConfigurationCallback<?>> clientConfigurers;
@ -58,8 +55,8 @@ class DefaultClientConfiguration implements ClientConfiguration {
DefaultClientConfiguration(List<InetSocketAddress> hosts, HttpHeaders headers, boolean useSsl, DefaultClientConfiguration(List<InetSocketAddress> hosts, HttpHeaders headers, boolean useSsl,
@Nullable SSLContext sslContext, Duration soTimeout, Duration connectTimeout, @Nullable String pathPrefix, @Nullable SSLContext sslContext, Duration soTimeout, Duration connectTimeout, @Nullable String pathPrefix,
@Nullable HostnameVerifier hostnameVerifier, @Nullable String proxy, @Nullable HostnameVerifier hostnameVerifier, @Nullable String proxy,
Function<WebClient, WebClient> webClientConfigurer, HttpClientConfigCallback httpClientConfigurer, HttpClientConfigCallback httpClientConfigurer, List<ClientConfigurationCallback<?>> clientConfigurers,
List<ClientConfigurationCallback<?>> clientConfigurers, Supplier<HttpHeaders> headersSupplier) { Supplier<HttpHeaders> headersSupplier) {
this.hosts = List.copyOf(hosts); this.hosts = List.copyOf(hosts);
this.headers = headers; this.headers = headers;
@ -70,7 +67,6 @@ class DefaultClientConfiguration implements ClientConfiguration {
this.pathPrefix = pathPrefix; this.pathPrefix = pathPrefix;
this.hostnameVerifier = hostnameVerifier; this.hostnameVerifier = hostnameVerifier;
this.proxy = proxy; this.proxy = proxy;
this.webClientConfigurer = webClientConfigurer;
this.httpClientConfigurer = httpClientConfigurer; this.httpClientConfigurer = httpClientConfigurer;
this.clientConfigurers = clientConfigurers; this.clientConfigurers = clientConfigurers;
this.headersSupplier = headersSupplier; this.headersSupplier = headersSupplier;
@ -122,11 +118,6 @@ class DefaultClientConfiguration implements ClientConfiguration {
return Optional.ofNullable(proxy); return Optional.ofNullable(proxy);
} }
@Override
public Function<WebClient, WebClient> getWebClientConfigurer() {
return webClientConfigurer;
}
@Override @Override
public <T> List<ClientConfigurationCallback<?>> getClientConfigurers() { public <T> List<ClientConfigurationCallback<?>> getClientConfigurers() {
return clientConfigurers; return clientConfigurers;

View File

@ -153,15 +153,6 @@ public class ClientConfigurationUnitTests {
assertThat(clientConfiguration.getHostNameVerifier()).contains(NoopHostnameVerifier.INSTANCE); assertThat(clientConfiguration.getHostNameVerifier()).contains(NoopHostnameVerifier.INSTANCE);
} }
@Test // DATAES-719
void shouldHaveDefaultWebClientConfigurer() {
ClientConfiguration clientConfiguration = ClientConfiguration.builder() //
.connectedTo("foo", "bar") //
.build();
assertThat(clientConfiguration.getWebClientConfigurer()).isEqualTo(Function.identity());
}
@Test // #1885 @Test // #1885
@DisplayName("should use configured httpClientConfigurer as client configurer") @DisplayName("should use configured httpClientConfigurer as client configurer")
void shouldUseConfiguredHttpClientConfigurerAsClientConfigurer() { void shouldUseConfiguredHttpClientConfigurerAsClientConfigurer() {