From af5d72b94f5a3ec1be6e00ae9681be1ff494e129 Mon Sep 17 00:00:00 2001 From: Dmytro Nosan Date: Wed, 2 Apr 2025 18:12:07 +0300 Subject: [PATCH 1/2] Update RestClientSsl to support ClientHttpRequestFactorySettings Prior to this commit, RestClientSsl always used the default settings from ClientHttpRequestFactorySettings, overriding any user-defined settings (e.g., HttpClientProperties). With this commit, RestClientSsl now respects and uses ClientHttpRequestFactorySettings when they are provided. See gh-44979 Signed-off-by: Dmytro Nosan --- .../client/AutoConfiguredRestClientSsl.java | 9 +- .../client/RestClientAutoConfiguration.java | 7 +- .../AutoConfiguredRestClientSslTests.java | 102 ++++++++++++++++++ .../RestClientAutoConfigurationTests.java | 42 +++++++- 4 files changed, 152 insertions(+), 8 deletions(-) create mode 100644 spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/AutoConfiguredRestClientSslTests.java diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/client/AutoConfiguredRestClientSsl.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/client/AutoConfiguredRestClientSsl.java index 0bdf8fd80ac..cecdb4528e9 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/client/AutoConfiguredRestClientSsl.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/client/AutoConfiguredRestClientSsl.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,11 +34,14 @@ class AutoConfiguredRestClientSsl implements RestClientSsl { private final ClientHttpRequestFactoryBuilder clientHttpRequestFactoryBuilder; + private final ClientHttpRequestFactorySettings clientHttpRequestFactorySettings; + private final SslBundles sslBundles; AutoConfiguredRestClientSsl(ClientHttpRequestFactoryBuilder clientHttpRequestFactoryBuilder, - SslBundles sslBundles) { + ClientHttpRequestFactorySettings clientHttpRequestFactorySettings, SslBundles sslBundles) { this.clientHttpRequestFactoryBuilder = clientHttpRequestFactoryBuilder; + this.clientHttpRequestFactorySettings = clientHttpRequestFactorySettings; this.sslBundles = sslBundles; } @@ -50,7 +53,7 @@ class AutoConfiguredRestClientSsl implements RestClientSsl { @Override public Consumer fromBundle(SslBundle bundle) { return (builder) -> { - ClientHttpRequestFactorySettings settings = ClientHttpRequestFactorySettings.ofSslBundle(bundle); + ClientHttpRequestFactorySettings settings = this.clientHttpRequestFactorySettings.withSslBundle(bundle); ClientHttpRequestFactory requestFactory = this.clientHttpRequestFactoryBuilder.build(settings); builder.requestFactory(requestFactory); }; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/client/RestClientAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/client/RestClientAutoConfiguration.java index f89fc31b660..f50d99a271e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/client/RestClientAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/client/RestClientAutoConfiguration.java @@ -68,9 +68,12 @@ public class RestClientAutoConfiguration { @ConditionalOnMissingBean(RestClientSsl.class) @ConditionalOnBean(SslBundles.class) AutoConfiguredRestClientSsl restClientSsl( - ObjectProvider> clientHttpRequestFactoryBuilder, SslBundles sslBundles) { + ObjectProvider> clientHttpRequestFactoryBuilder, + ObjectProvider clientHttpRequestFactorySettings, SslBundles sslBundles) { return new AutoConfiguredRestClientSsl( - clientHttpRequestFactoryBuilder.getIfAvailable(ClientHttpRequestFactoryBuilder::detect), sslBundles); + clientHttpRequestFactoryBuilder.getIfAvailable(ClientHttpRequestFactoryBuilder::detect), + clientHttpRequestFactorySettings.getIfAvailable(ClientHttpRequestFactorySettings::defaults), + sslBundles); } @Bean diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/AutoConfiguredRestClientSslTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/AutoConfiguredRestClientSslTests.java new file mode 100644 index 00000000000..de15231c21e --- /dev/null +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/AutoConfiguredRestClientSslTests.java @@ -0,0 +1,102 @@ +/* + * Copyright 2012-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.autoconfigure.web.client; + +import java.time.Duration; +import java.util.function.Consumer; +import java.util.function.Function; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; + +import org.springframework.boot.http.client.ClientHttpRequestFactoryBuilder; +import org.springframework.boot.http.client.ClientHttpRequestFactorySettings; +import org.springframework.boot.http.client.ClientHttpRequestFactorySettings.Redirects; +import org.springframework.boot.ssl.SslBundle; +import org.springframework.boot.ssl.SslBundles; +import org.springframework.http.client.ClientHttpRequestFactory; +import org.springframework.web.client.RestClient; +import org.springframework.web.client.RestClient.Builder; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; + +/** + * Tests for {@link AutoConfiguredRestClientSsl}. + * + * @author Dmytro Nosan + */ +@ExtendWith(MockitoExtension.class) +class AutoConfiguredRestClientSslTests { + + private final ClientHttpRequestFactorySettings clientHttpRequestFactorySettings = ClientHttpRequestFactorySettings + .ofSslBundle(mock(SslBundle.class, "Default SslBundle")) + .withRedirects(Redirects.DONT_FOLLOW) + .withReadTimeout(Duration.ofSeconds(10)) + .withConnectTimeout(Duration.ofSeconds(30)); + + @Mock + private SslBundles sslBundles; + + @Mock + private ClientHttpRequestFactoryBuilder clientHttpRequestFactoryBuilder; + + @Mock + private ClientHttpRequestFactory clientHttpRequestFactory; + + @Test + void shouldConfigureRestClientUsingBundleName() { + String bundleName = "test"; + SslBundle sslBundle = mock(SslBundle.class, "SslBundle named '%s'".formatted(bundleName)); + + given(this.sslBundles.getBundle(bundleName)).willReturn(sslBundle); + given(this.clientHttpRequestFactoryBuilder + .build(this.clientHttpRequestFactorySettings.withSslBundle(sslBundle))) + .willReturn(this.clientHttpRequestFactory); + + assertThat(applySslBundle((restClientSsl) -> restClientSsl.fromBundle(bundleName))) + .hasFieldOrPropertyWithValue("clientRequestFactory", this.clientHttpRequestFactory); + + } + + @Test + void shouldConfigureRestClientUsingBundle() { + SslBundle sslBundle = mock(SslBundle.class, "Custom SslBundle"); + + given(this.clientHttpRequestFactoryBuilder + .build(this.clientHttpRequestFactorySettings.withSslBundle(sslBundle))) + .willReturn(this.clientHttpRequestFactory); + + assertThat(applySslBundle((restClientSsl) -> restClientSsl.fromBundle(sslBundle))) + .hasFieldOrPropertyWithValue("clientRequestFactory", this.clientHttpRequestFactory); + } + + private RestClient applySslBundle(Function> applySslBundle) { + Builder builder = RestClient.builder(); + applySslBundle.apply(getRestClientSsl()).accept(builder); + return builder.build(); + } + + private RestClientSsl getRestClientSsl() { + return new AutoConfiguredRestClientSsl(this.clientHttpRequestFactoryBuilder, + this.clientHttpRequestFactorySettings, this.sslBundles); + } + +} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/RestClientAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/RestClientAutoConfigurationTests.java index fae799d96a9..251cf3c5690 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/RestClientAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/RestClientAutoConfigurationTests.java @@ -16,6 +16,7 @@ package org.springframework.boot.autoconfigure.web.client; +import java.time.Duration; import java.util.List; import org.junit.jupiter.api.Test; @@ -27,6 +28,7 @@ import org.springframework.boot.autoconfigure.http.client.HttpClientAutoConfigur import org.springframework.boot.http.client.ClientHttpRequestFactoryBuilder; import org.springframework.boot.http.client.ClientHttpRequestFactorySettings; import org.springframework.boot.http.client.ClientHttpRequestFactorySettings.Redirects; +import org.springframework.boot.ssl.SslBundle; import org.springframework.boot.ssl.SslBundles; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.web.client.RestClientCustomizer; @@ -66,9 +68,43 @@ class RestClientAutoConfigurationTests { } @Test - void shouldSupplyRestClientSslIfSslBundlesIsThere() { - this.contextRunner.withBean(SslBundles.class, () -> mock(SslBundles.class)) - .run((context) -> assertThat(context).hasSingleBean(RestClientSsl.class)); + void shouldSupplyRestClientSslIfSslBundlesIsThereWithCustomHttpSettingsAndBuilder() { + SslBundles sslBundles = mock(SslBundles.class); + ClientHttpRequestFactorySettings clientHttpRequestFactorySettings = ClientHttpRequestFactorySettings.defaults() + .withRedirects(Redirects.DONT_FOLLOW) + .withConnectTimeout(Duration.ofHours(1)) + .withReadTimeout(Duration.ofDays(1)) + .withSslBundle(mock(SslBundle.class)); + ClientHttpRequestFactoryBuilder clientHttpRequestFactoryBuilder = mock( + ClientHttpRequestFactoryBuilder.class); + this.contextRunner.withBean(SslBundles.class, () -> sslBundles) + .withBean(ClientHttpRequestFactorySettings.class, () -> clientHttpRequestFactorySettings) + .withBean(ClientHttpRequestFactoryBuilder.class, () -> clientHttpRequestFactoryBuilder) + .run((context) -> { + assertThat(context).hasSingleBean(RestClientSsl.class); + RestClientSsl restClientSsl = context.getBean(RestClientSsl.class); + assertThat(restClientSsl).hasFieldOrPropertyWithValue("sslBundles", sslBundles); + assertThat(restClientSsl).hasFieldOrPropertyWithValue("clientHttpRequestFactoryBuilder", + clientHttpRequestFactoryBuilder); + assertThat(restClientSsl).hasFieldOrPropertyWithValue("clientHttpRequestFactorySettings", + clientHttpRequestFactorySettings); + }); + } + + @Test + void shouldSupplyRestClientSslIfSslBundlesIsThereWithAutoConfiguredHttpSettingsAndBuilder() { + SslBundles sslBundles = mock(SslBundles.class); + this.contextRunner.withBean(SslBundles.class, () -> sslBundles).run((context) -> { + assertThat(context).hasSingleBean(RestClientSsl.class) + .hasSingleBean(ClientHttpRequestFactorySettings.class) + .hasSingleBean(ClientHttpRequestFactoryBuilder.class); + RestClientSsl restClientSsl = context.getBean(RestClientSsl.class); + assertThat(restClientSsl).hasFieldOrPropertyWithValue("sslBundles", sslBundles); + assertThat(restClientSsl).hasFieldOrPropertyWithValue("clientHttpRequestFactoryBuilder", + context.getBean(ClientHttpRequestFactoryBuilder.class)); + assertThat(restClientSsl).hasFieldOrPropertyWithValue("clientHttpRequestFactorySettings", + context.getBean(ClientHttpRequestFactorySettings.class)); + }); } @Test From 567353a555df11c4d2ef80d490b9286751beb606 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Mon, 14 Apr 2025 19:27:56 -0700 Subject: [PATCH 2/2] Polish 'Update RestClientSsl to support ClientHttpRequestFactorySettings' See gh-44979 --- .../client/AutoConfiguredRestClientSsl.java | 19 +++---- .../web/client/RestClientSsl.java | 6 ++- .../AutoConfiguredRestClientSslTests.java | 51 ++++++++----------- .../RestClientAutoConfigurationTests.java | 11 ++-- 4 files changed, 42 insertions(+), 45 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/client/AutoConfiguredRestClientSsl.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/client/AutoConfiguredRestClientSsl.java index cecdb4528e9..5fc5c1052dc 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/client/AutoConfiguredRestClientSsl.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/client/AutoConfiguredRestClientSsl.java @@ -29,19 +29,20 @@ import org.springframework.web.client.RestClient; * An auto-configured {@link RestClientSsl} implementation. * * @author Phillip Webb + * @author Dmytro Nosan */ class AutoConfiguredRestClientSsl implements RestClientSsl { - private final ClientHttpRequestFactoryBuilder clientHttpRequestFactoryBuilder; + private final ClientHttpRequestFactoryBuilder builder; - private final ClientHttpRequestFactorySettings clientHttpRequestFactorySettings; + private final ClientHttpRequestFactorySettings settings; private final SslBundles sslBundles; AutoConfiguredRestClientSsl(ClientHttpRequestFactoryBuilder clientHttpRequestFactoryBuilder, ClientHttpRequestFactorySettings clientHttpRequestFactorySettings, SslBundles sslBundles) { - this.clientHttpRequestFactoryBuilder = clientHttpRequestFactoryBuilder; - this.clientHttpRequestFactorySettings = clientHttpRequestFactorySettings; + this.builder = clientHttpRequestFactoryBuilder; + this.settings = clientHttpRequestFactorySettings; this.sslBundles = sslBundles; } @@ -52,11 +53,11 @@ class AutoConfiguredRestClientSsl implements RestClientSsl { @Override public Consumer fromBundle(SslBundle bundle) { - return (builder) -> { - ClientHttpRequestFactorySettings settings = this.clientHttpRequestFactorySettings.withSslBundle(bundle); - ClientHttpRequestFactory requestFactory = this.clientHttpRequestFactoryBuilder.build(settings); - builder.requestFactory(requestFactory); - }; + return (builder) -> builder.requestFactory(requestFactory(bundle)); + } + + private ClientHttpRequestFactory requestFactory(SslBundle bundle) { + return this.builder.build(this.settings.withSslBundle(bundle)); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/client/RestClientSsl.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/client/RestClientSsl.java index e7795beb8ce..2436fa1b228 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/client/RestClientSsl.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/client/RestClientSsl.java @@ -19,6 +19,7 @@ package org.springframework.boot.autoconfigure.web.client; import java.util.function.Consumer; import org.springframework.boot.http.client.ClientHttpRequestFactoryBuilder; +import org.springframework.boot.http.client.ClientHttpRequestFactorySettings; import org.springframework.boot.ssl.NoSuchSslBundleException; import org.springframework.boot.ssl.SslBundle; import org.springframework.http.client.ClientHttpRequestFactory; @@ -34,8 +35,11 @@ import org.springframework.web.client.RestClient; * RestClient restClient = restClientBuilder.apply(ssl.fromBundle("mybundle")).build(); * return new MyBean(restClient); * } - * NOTE: Apply SSL configuration will replace any previously + * NOTE: Applying SSL configuration will replace any previously * {@link RestClient.Builder#requestFactory configured} {@link ClientHttpRequestFactory}. + * The replacement {@link ClientHttpRequestFactory} will apply only configured + * {@link ClientHttpRequestFactorySettings} and the appropriate {@link SslBundle}. + *

* If you need to configure {@link ClientHttpRequestFactory} with more than just SSL * consider using a {@link ClientHttpRequestFactoryBuilder}. * diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/AutoConfiguredRestClientSslTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/AutoConfiguredRestClientSslTests.java index de15231c21e..ec6b2b9932a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/AutoConfiguredRestClientSslTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/AutoConfiguredRestClientSslTests.java @@ -18,12 +18,11 @@ package org.springframework.boot.autoconfigure.web.client; import java.time.Duration; import java.util.function.Consumer; -import java.util.function.Function; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; +import org.mockito.MockitoAnnotations; import org.springframework.boot.http.client.ClientHttpRequestFactoryBuilder; import org.springframework.boot.http.client.ClientHttpRequestFactorySettings; @@ -42,11 +41,11 @@ import static org.mockito.Mockito.mock; * Tests for {@link AutoConfiguredRestClientSsl}. * * @author Dmytro Nosan + * @author Phillip Webb */ -@ExtendWith(MockitoExtension.class) class AutoConfiguredRestClientSslTests { - private final ClientHttpRequestFactorySettings clientHttpRequestFactorySettings = ClientHttpRequestFactorySettings + private final ClientHttpRequestFactorySettings settings = ClientHttpRequestFactorySettings .ofSslBundle(mock(SslBundle.class, "Default SslBundle")) .withRedirects(Redirects.DONT_FOLLOW) .withReadTimeout(Duration.ofSeconds(10)) @@ -56,47 +55,41 @@ class AutoConfiguredRestClientSslTests { private SslBundles sslBundles; @Mock - private ClientHttpRequestFactoryBuilder clientHttpRequestFactoryBuilder; + private ClientHttpRequestFactoryBuilder factoryBuilder; @Mock - private ClientHttpRequestFactory clientHttpRequestFactory; + private ClientHttpRequestFactory factory; + + private AutoConfiguredRestClientSsl restClientSsl; + + @BeforeEach + void setup() { + MockitoAnnotations.openMocks(this); + this.restClientSsl = new AutoConfiguredRestClientSsl(this.factoryBuilder, this.settings, this.sslBundles); + } @Test void shouldConfigureRestClientUsingBundleName() { String bundleName = "test"; SslBundle sslBundle = mock(SslBundle.class, "SslBundle named '%s'".formatted(bundleName)); - given(this.sslBundles.getBundle(bundleName)).willReturn(sslBundle); - given(this.clientHttpRequestFactoryBuilder - .build(this.clientHttpRequestFactorySettings.withSslBundle(sslBundle))) - .willReturn(this.clientHttpRequestFactory); - - assertThat(applySslBundle((restClientSsl) -> restClientSsl.fromBundle(bundleName))) - .hasFieldOrPropertyWithValue("clientRequestFactory", this.clientHttpRequestFactory); - + given(this.factoryBuilder.build(this.settings.withSslBundle(sslBundle))).willReturn(this.factory); + RestClient restClient = build(this.restClientSsl.fromBundle(bundleName)); + assertThat(restClient).hasFieldOrPropertyWithValue("clientRequestFactory", this.factory); } @Test void shouldConfigureRestClientUsingBundle() { SslBundle sslBundle = mock(SslBundle.class, "Custom SslBundle"); - - given(this.clientHttpRequestFactoryBuilder - .build(this.clientHttpRequestFactorySettings.withSslBundle(sslBundle))) - .willReturn(this.clientHttpRequestFactory); - - assertThat(applySslBundle((restClientSsl) -> restClientSsl.fromBundle(sslBundle))) - .hasFieldOrPropertyWithValue("clientRequestFactory", this.clientHttpRequestFactory); + given(this.factoryBuilder.build(this.settings.withSslBundle(sslBundle))).willReturn(this.factory); + RestClient restClient = build(this.restClientSsl.fromBundle(sslBundle)); + assertThat(restClient).hasFieldOrPropertyWithValue("clientRequestFactory", this.factory); } - private RestClient applySslBundle(Function> applySslBundle) { + private RestClient build(Consumer customizer) { Builder builder = RestClient.builder(); - applySslBundle.apply(getRestClientSsl()).accept(builder); + customizer.accept(builder); return builder.build(); } - private RestClientSsl getRestClientSsl() { - return new AutoConfiguredRestClientSsl(this.clientHttpRequestFactoryBuilder, - this.clientHttpRequestFactorySettings, this.sslBundles); - } - } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/RestClientAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/RestClientAutoConfigurationTests.java index 251cf3c5690..b114f52f11f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/RestClientAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/client/RestClientAutoConfigurationTests.java @@ -52,6 +52,7 @@ import static org.mockito.Mockito.mock; * * @author Arjen Poutsma * @author Moritz Halbritter + * @author Dmytro Nosan */ class RestClientAutoConfigurationTests { @@ -84,10 +85,8 @@ class RestClientAutoConfigurationTests { assertThat(context).hasSingleBean(RestClientSsl.class); RestClientSsl restClientSsl = context.getBean(RestClientSsl.class); assertThat(restClientSsl).hasFieldOrPropertyWithValue("sslBundles", sslBundles); - assertThat(restClientSsl).hasFieldOrPropertyWithValue("clientHttpRequestFactoryBuilder", - clientHttpRequestFactoryBuilder); - assertThat(restClientSsl).hasFieldOrPropertyWithValue("clientHttpRequestFactorySettings", - clientHttpRequestFactorySettings); + assertThat(restClientSsl).hasFieldOrPropertyWithValue("builder", clientHttpRequestFactoryBuilder); + assertThat(restClientSsl).hasFieldOrPropertyWithValue("settings", clientHttpRequestFactorySettings); }); } @@ -100,9 +99,9 @@ class RestClientAutoConfigurationTests { .hasSingleBean(ClientHttpRequestFactoryBuilder.class); RestClientSsl restClientSsl = context.getBean(RestClientSsl.class); assertThat(restClientSsl).hasFieldOrPropertyWithValue("sslBundles", sslBundles); - assertThat(restClientSsl).hasFieldOrPropertyWithValue("clientHttpRequestFactoryBuilder", + assertThat(restClientSsl).hasFieldOrPropertyWithValue("builder", context.getBean(ClientHttpRequestFactoryBuilder.class)); - assertThat(restClientSsl).hasFieldOrPropertyWithValue("clientHttpRequestFactorySettings", + assertThat(restClientSsl).hasFieldOrPropertyWithValue("settings", context.getBean(ClientHttpRequestFactorySettings.class)); }); }