diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index bbf55d26a0..07b1af91f4 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -7428,7 +7428,7 @@ can also customize read and connection timeouts as follows: @Bean public WebServiceTemplate webServiceTemplate(WebServiceTemplateBuilder builder) { return builder.messageSenders(new HttpWebServiceMessageSenderBuilder() - .setReadTimeout(5000).setConnectionTimeout(2000).build()).build(); + .setConnectTimeout(5000).setReadTimeout(2000).build()).build(); } ---- diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java index 5038a5ecd0..88cf18909c 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java @@ -451,9 +451,9 @@ public class RestTemplateBuilder { } /** - * Sets the connect timeout in milliseconds on the underlying + * Sets the connection timeout in milliseconds on the underlying * {@link ClientHttpRequestFactory}. - * @param connectTimeout the connect timeout in milliseconds + * @param connectTimeout the connection timeout in milliseconds * @return a new builder instance. */ public RestTemplateBuilder setConnectTimeout(int connectTimeout) { @@ -641,7 +641,7 @@ public class RestTemplateBuilder { } /** - * {@link RequestFactoryCustomizer} to set the connect timeout. + * {@link RequestFactoryCustomizer} to set the connection timeout. */ private static class ConnectTimeoutRequestFactoryCustomizer extends TimeoutRequestFactoryCustomizer { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilder.java index e5c998b246..1192a9a1f6 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilder.java @@ -35,7 +35,7 @@ import org.springframework.ws.transport.http.ClientHttpRequestMessageSender; */ public class HttpWebServiceMessageSenderBuilder { - private Integer connectionTimeout; + private Integer connectTimeout; private Integer readTimeout; @@ -43,12 +43,11 @@ public class HttpWebServiceMessageSenderBuilder { /** * Set the connection timeout in milliseconds. - * @param connectionTimeout the connection timeout in milliseconds + * @param connectTimeout the connection timeout in milliseconds * @return a new builder instance */ - public HttpWebServiceMessageSenderBuilder setConnectionTimeout( - int connectionTimeout) { - this.connectionTimeout = connectionTimeout; + public HttpWebServiceMessageSenderBuilder setConnectTimeout(int connectTimeout) { + this.connectTimeout = connectTimeout; return this; } @@ -80,9 +79,9 @@ public class HttpWebServiceMessageSenderBuilder { ClientHttpRequestFactory requestFactory = (this.requestFactorySupplier != null ? this.requestFactorySupplier.get() : new ClientHttpRequestFactorySupplier().get()); - if (this.connectionTimeout != null) { - new TimeoutRequestFactoryCustomizer(this.connectionTimeout, - "setConnectTimeout").customize(requestFactory); + if (this.connectTimeout != null) { + new TimeoutRequestFactoryCustomizer(this.connectTimeout, "setConnectTimeout") + .customize(requestFactory); } if (this.readTimeout != null) { new TimeoutRequestFactoryCustomizer(this.readTimeout, "setReadTimeout") diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilderOkHttp3IntegrationTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilderOkHttp3IntegrationTests.java index 3edea2ae6d..cfce3e2348 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilderOkHttp3IntegrationTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilderOkHttp3IntegrationTests.java @@ -50,7 +50,7 @@ public class HttpWebServiceMessageSenderBuilderOkHttp3IntegrationTests { @Test public void buildWithCustomTimeouts() { - WebServiceMessageSender messageSender = this.builder.setConnectionTimeout(5000) + WebServiceMessageSender messageSender = this.builder.setConnectTimeout(5000) .setReadTimeout(2000).build(); OkHttp3ClientHttpRequestFactory factory = assertOkHttp3RequestFactory( messageSender); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilderSimpleIntegrationTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilderSimpleIntegrationTests.java index 361927ff29..4f3b93bfac 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilderSimpleIntegrationTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilderSimpleIntegrationTests.java @@ -49,7 +49,7 @@ public class HttpWebServiceMessageSenderBuilderSimpleIntegrationTests { @Test public void buildWithCustomTimeouts() { - WebServiceMessageSender messageSender = this.builder.setConnectionTimeout(5000) + WebServiceMessageSender messageSender = this.builder.setConnectTimeout(5000) .setReadTimeout(2000).build(); SimpleClientHttpRequestFactory requestFactory = assertSimpleClientRequestFactory( messageSender); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilderTests.java index e844882a1f..82cf988dbd 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilderTests.java @@ -50,7 +50,7 @@ public class HttpWebServiceMessageSenderBuilderTests { ClientHttpRequestMessageSender messageSender = build( new HttpWebServiceMessageSenderBuilder() .requestFactory(SimpleClientHttpRequestFactory::new) - .setConnectionTimeout(5000).setReadTimeout(2000)); + .setConnectTimeout(5000).setReadTimeout(2000)); SimpleClientHttpRequestFactory requestFactory = (SimpleClientHttpRequestFactory) messageSender .getRequestFactory(); assertThat(ReflectionTestUtils.getField(requestFactory, "connectTimeout")) @@ -60,9 +60,9 @@ public class HttpWebServiceMessageSenderBuilderTests { } @Test - public void buildUsesHttpComponentsBydefault() { + public void buildUsesHttpComponentsByDefault() { ClientHttpRequestMessageSender messageSender = build( - new HttpWebServiceMessageSenderBuilder().setConnectionTimeout(5000) + new HttpWebServiceMessageSenderBuilder().setConnectTimeout(5000) .setReadTimeout(2000)); ClientHttpRequestFactory requestFactory = messageSender.getRequestFactory(); assertThat(requestFactory)