Create spring-boot-http-client module
This commit is contained in:
parent
c474b4bbb8
commit
5c90bf9fc3
|
@ -77,6 +77,7 @@ include "spring-boot-project:spring-boot-h2console"
|
|||
include "spring-boot-project:spring-boot-hateoas"
|
||||
include "spring-boot-project:spring-boot-hazelcast"
|
||||
include "spring-boot-project:spring-boot-http"
|
||||
include "spring-boot-project:spring-boot-http-client"
|
||||
include "spring-boot-project:spring-boot-http-codec"
|
||||
include "spring-boot-project:spring-boot-integration"
|
||||
include "spring-boot-project:spring-boot-integration-tests"
|
||||
|
|
|
@ -41,6 +41,7 @@ dependencies {
|
|||
optional(project(":spring-boot-project:spring-boot-flyway"))
|
||||
optional(project(":spring-boot-project:spring-boot-hazelcast"))
|
||||
optional(project(":spring-boot-project:spring-boot-http"))
|
||||
optional(project(":spring-boot-project:spring-boot-http-client"))
|
||||
optional(project(":spring-boot-project:spring-boot-http-codec"))
|
||||
optional(project(":spring-boot-project:spring-boot-integration"))
|
||||
optional(project(":spring-boot-project:spring-boot-jackson"))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2023 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.
|
||||
|
@ -31,8 +31,6 @@ import org.springframework.boot.autoconfigure.AutoConfiguration;
|
|||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.web.client.RestClientAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
@ -52,8 +50,11 @@ import org.springframework.core.annotation.Order;
|
|||
* @author Moritz Halbritter
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@AutoConfiguration(after = { ObservationAutoConfiguration.class, CompositeMeterRegistryAutoConfiguration.class,
|
||||
RestTemplateAutoConfiguration.class, WebClientAutoConfiguration.class, RestClientAutoConfiguration.class })
|
||||
@AutoConfiguration(
|
||||
after = { ObservationAutoConfiguration.class, CompositeMeterRegistryAutoConfiguration.class,
|
||||
WebClientAutoConfiguration.class },
|
||||
afterName = { "org.springframework.boot.http.client.rest.autoconfigure.RestClientAutoConfiguration",
|
||||
"org.springframework.boot.http.client.rest.autoconfigure.RestTemplateAutoConfiguration" })
|
||||
@ConditionalOnClass(Observation.class)
|
||||
@ConditionalOnBean(ObservationRegistry.class)
|
||||
@Import({ RestTemplateObservationConfiguration.class, WebClientObservationConfiguration.class,
|
||||
|
|
|
@ -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.
|
||||
|
@ -25,7 +25,6 @@ import org.springframework.boot.autoconfigure.AutoConfiguration;
|
|||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
@ -39,7 +38,7 @@ import org.springframework.context.annotation.Import;
|
|||
* @author Moritz Halbritter
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@AutoConfiguration(after = RestTemplateAutoConfiguration.class)
|
||||
@AutoConfiguration(afterName = "org.springframework.boot.http.client.rest.autoconfigure.RestTemplateAutoConfiguration")
|
||||
@ConditionalOnClass(Encoding.class)
|
||||
@Import({ SenderConfiguration.class, BraveConfiguration.class, OpenTelemetryConfiguration.class })
|
||||
@EnableConfigurationProperties(ZipkinProperties.class)
|
||||
|
|
|
@ -39,8 +39,8 @@ import org.springframework.boot.actuate.endpoint.web.WebOperation;
|
|||
import org.springframework.boot.actuate.endpoint.web.WebOperationRequestPredicate;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration;
|
||||
import org.springframework.boot.http.autoconfigure.HttpMessageConvertersAutoConfiguration;
|
||||
import org.springframework.boot.http.client.rest.autoconfigure.RestTemplateAutoConfiguration;
|
||||
import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration;
|
||||
import org.springframework.boot.security.autoconfigure.servlet.SecurityAutoConfiguration;
|
||||
import org.springframework.boot.test.context.assertj.AssertableWebApplicationContext;
|
||||
|
|
|
@ -31,8 +31,8 @@ import org.springframework.boot.actuate.health.HealthComponent;
|
|||
import org.springframework.boot.actuate.health.HealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration;
|
||||
import org.springframework.boot.http.autoconfigure.HttpMessageConvertersAutoConfiguration;
|
||||
import org.springframework.boot.http.client.rest.autoconfigure.RestTemplateAutoConfiguration;
|
||||
import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration;
|
||||
import org.springframework.boot.security.autoconfigure.servlet.SecurityAutoConfiguration;
|
||||
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
|
||||
|
|
|
@ -30,8 +30,8 @@ import org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagem
|
|||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration;
|
||||
import org.springframework.boot.http.autoconfigure.HttpMessageConvertersAutoConfiguration;
|
||||
import org.springframework.boot.http.client.rest.autoconfigure.RestTemplateAutoConfiguration;
|
||||
import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration;
|
||||
import org.springframework.boot.security.autoconfigure.servlet.SecurityAutoConfiguration;
|
||||
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
|
||||
|
|
|
@ -47,8 +47,8 @@ import org.springframework.boot.actuate.autoconfigure.observation.web.client.Htt
|
|||
import org.springframework.boot.actuate.autoconfigure.observation.web.reactive.WebFluxObservationAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.observation.web.servlet.WebMvcObservationAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration;
|
||||
import org.springframework.boot.http.autoconfigure.HttpMessageConvertersAutoConfiguration;
|
||||
import org.springframework.boot.http.client.rest.autoconfigure.RestTemplateAutoConfiguration;
|
||||
import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
|
|
|
@ -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.
|
||||
|
@ -27,7 +27,7 @@ import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun;
|
|||
import org.springframework.boot.actuate.autoconfigure.observation.ObservationAutoConfiguration;
|
||||
import org.springframework.boot.actuate.metrics.web.client.ObservationRestClientCustomizer;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.web.client.RestClientAutoConfiguration;
|
||||
import org.springframework.boot.http.client.rest.autoconfigure.RestClientAutoConfiguration;
|
||||
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.test.system.CapturedOutput;
|
||||
|
|
|
@ -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.
|
||||
|
@ -23,7 +23,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
|||
|
||||
import org.springframework.boot.actuate.autoconfigure.observation.ObservationAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.web.client.RestClientAutoConfiguration;
|
||||
import org.springframework.boot.http.client.rest.autoconfigure.RestClientAutoConfiguration;
|
||||
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.test.system.OutputCaptureExtension;
|
||||
|
|
|
@ -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.
|
||||
|
@ -27,7 +27,7 @@ import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun;
|
|||
import org.springframework.boot.actuate.autoconfigure.observation.ObservationAutoConfiguration;
|
||||
import org.springframework.boot.actuate.metrics.web.client.ObservationRestTemplateCustomizer;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration;
|
||||
import org.springframework.boot.http.client.rest.autoconfigure.RestTemplateAutoConfiguration;
|
||||
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.test.system.CapturedOutput;
|
||||
|
|
|
@ -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.
|
||||
|
@ -23,7 +23,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
|||
|
||||
import org.springframework.boot.actuate.autoconfigure.observation.ObservationAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration;
|
||||
import org.springframework.boot.http.client.rest.autoconfigure.RestTemplateAutoConfiguration;
|
||||
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.test.system.OutputCaptureExtension;
|
||||
|
|
|
@ -25,8 +25,8 @@ import org.springframework.boot.actuate.autoconfigure.observation.web.client.Htt
|
|||
import org.springframework.boot.actuate.autoconfigure.tracing.BraveAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.MicrometerTracingAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration;
|
||||
import org.springframework.boot.http.client.rest.autoconfigure.RestTemplateAutoConfiguration;
|
||||
import org.springframework.boot.test.context.assertj.ApplicationContextAssertProvider;
|
||||
import org.springframework.boot.test.context.runner.AbstractApplicationContextRunner;
|
||||
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
|
||||
|
|
|
@ -1,102 +0,0 @@
|
|||
/*
|
||||
* 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.http.client;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import org.springframework.boot.http.client.HttpClientSettings;
|
||||
import org.springframework.boot.http.client.HttpRedirects;
|
||||
|
||||
/**
|
||||
* Abstract base class for properties that directly or indirectly make use of a blocking
|
||||
* or reactive HTTP client.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @since 3.5.0
|
||||
* @see HttpClientSettings
|
||||
*/
|
||||
public abstract class AbstractHttpClientProperties {
|
||||
|
||||
/**
|
||||
* Handling for HTTP redirects.
|
||||
*/
|
||||
private HttpRedirects redirects;
|
||||
|
||||
/**
|
||||
* Default connect timeout for a client HTTP request.
|
||||
*/
|
||||
private Duration connectTimeout;
|
||||
|
||||
/**
|
||||
* Default read timeout for a client HTTP request.
|
||||
*/
|
||||
private Duration readTimeout;
|
||||
|
||||
/**
|
||||
* Default SSL configuration for a client HTTP request.
|
||||
*/
|
||||
private final Ssl ssl = new Ssl();
|
||||
|
||||
public HttpRedirects getRedirects() {
|
||||
return this.redirects;
|
||||
}
|
||||
|
||||
public void setRedirects(HttpRedirects redirects) {
|
||||
this.redirects = redirects;
|
||||
}
|
||||
|
||||
public Duration getConnectTimeout() {
|
||||
return this.connectTimeout;
|
||||
}
|
||||
|
||||
public void setConnectTimeout(Duration connectTimeout) {
|
||||
this.connectTimeout = connectTimeout;
|
||||
}
|
||||
|
||||
public Duration getReadTimeout() {
|
||||
return this.readTimeout;
|
||||
}
|
||||
|
||||
public void setReadTimeout(Duration readTimeout) {
|
||||
this.readTimeout = readTimeout;
|
||||
}
|
||||
|
||||
public Ssl getSsl() {
|
||||
return this.ssl;
|
||||
}
|
||||
|
||||
/**
|
||||
* SSL configuration.
|
||||
*/
|
||||
public static class Ssl {
|
||||
|
||||
/**
|
||||
* SSL bundle to use.
|
||||
*/
|
||||
private String bundle;
|
||||
|
||||
public String getBundle() {
|
||||
return this.bundle;
|
||||
}
|
||||
|
||||
public void setBundle(String bundle) {
|
||||
this.bundle = bundle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -16,10 +16,11 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.http.client.reactive;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.springframework.boot.autoconfigure.http.client.AbstractHttpClientProperties;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.http.client.HttpRedirects;
|
||||
import org.springframework.boot.http.client.reactive.ClientHttpConnectorBuilder;
|
||||
import org.springframework.boot.http.client.reactive.ClientHttpConnectorSettings;
|
||||
import org.springframework.http.client.reactive.ClientHttpConnector;
|
||||
|
@ -32,13 +33,61 @@ import org.springframework.http.client.reactive.ClientHttpConnector;
|
|||
* @since 3.5.0
|
||||
* @see ClientHttpConnectorSettings
|
||||
*/
|
||||
public abstract class AbstractClientHttpConnectorProperties extends AbstractHttpClientProperties {
|
||||
public abstract class AbstractClientHttpConnectorProperties {
|
||||
|
||||
/**
|
||||
* Handling for HTTP redirects.
|
||||
*/
|
||||
private HttpRedirects redirects;
|
||||
|
||||
/**
|
||||
* Default connect timeout for a client HTTP request.
|
||||
*/
|
||||
private Duration connectTimeout;
|
||||
|
||||
/**
|
||||
* Default read timeout for a client HTTP request.
|
||||
*/
|
||||
private Duration readTimeout;
|
||||
|
||||
/**
|
||||
* Default SSL configuration for a client HTTP request.
|
||||
*/
|
||||
private final Ssl ssl = new Ssl();
|
||||
|
||||
/**
|
||||
* Default connector used for a client HTTP request.
|
||||
*/
|
||||
private Connector connector;
|
||||
|
||||
public HttpRedirects getRedirects() {
|
||||
return this.redirects;
|
||||
}
|
||||
|
||||
public void setRedirects(HttpRedirects redirects) {
|
||||
this.redirects = redirects;
|
||||
}
|
||||
|
||||
public Duration getConnectTimeout() {
|
||||
return this.connectTimeout;
|
||||
}
|
||||
|
||||
public void setConnectTimeout(Duration connectTimeout) {
|
||||
this.connectTimeout = connectTimeout;
|
||||
}
|
||||
|
||||
public Duration getReadTimeout() {
|
||||
return this.readTimeout;
|
||||
}
|
||||
|
||||
public void setReadTimeout(Duration readTimeout) {
|
||||
this.readTimeout = readTimeout;
|
||||
}
|
||||
|
||||
public Ssl getSsl() {
|
||||
return this.ssl;
|
||||
}
|
||||
|
||||
public Connector getConnector() {
|
||||
return this.connector;
|
||||
}
|
||||
|
@ -47,6 +96,26 @@ public abstract class AbstractClientHttpConnectorProperties extends AbstractHttp
|
|||
this.connector = connector;
|
||||
}
|
||||
|
||||
/**
|
||||
* SSL configuration.
|
||||
*/
|
||||
public static class Ssl {
|
||||
|
||||
/**
|
||||
* SSL bundle to use.
|
||||
*/
|
||||
private String bundle;
|
||||
|
||||
public String getBundle() {
|
||||
return this.bundle;
|
||||
}
|
||||
|
||||
public void setBundle(String bundle) {
|
||||
this.bundle = bundle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Supported factory types.
|
||||
*/
|
||||
|
|
|
@ -22,8 +22,8 @@ import java.util.function.Function;
|
|||
import java.util.function.Predicate;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.http.client.AbstractHttpClientProperties.Ssl;
|
||||
import org.springframework.boot.autoconfigure.http.client.reactive.AbstractClientHttpConnectorProperties.Connector;
|
||||
import org.springframework.boot.autoconfigure.http.client.reactive.AbstractClientHttpConnectorProperties.Ssl;
|
||||
import org.springframework.boot.http.client.HttpRedirects;
|
||||
import org.springframework.boot.http.client.reactive.ClientHttpConnectorBuilder;
|
||||
import org.springframework.boot.http.client.reactive.ClientHttpConnectorSettings;
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
org.springframework.boot.autoconfigure.http.client.HttpClientAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.http.client.reactive.ClientHttpConnectorAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.web.client.RestClientAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.web.reactive.function.client.ClientHttpConnectorAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration
|
||||
|
|
|
@ -2049,6 +2049,7 @@ bom {
|
|||
"spring-boot-hateoas",
|
||||
"spring-boot-hazelcast",
|
||||
"spring-boot-http",
|
||||
"spring-boot-http-client",
|
||||
"spring-boot-http-codec",
|
||||
"spring-boot-integration",
|
||||
"spring-boot-jackson",
|
||||
|
|
|
@ -85,6 +85,7 @@ dependencies {
|
|||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-hateoas", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-hazelcast", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-http", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-http-client", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-http-codec", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-integration", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-jackson", configuration: "autoConfigurationMetadata"))
|
||||
|
@ -165,6 +166,7 @@ dependencies {
|
|||
configurationProperties(project(path: ":spring-boot-project:spring-boot-hateoas", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-hazelcast", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-http", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-http-client", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-http-codec", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-integration", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-jackson", configuration: "configurationPropertiesMetadata"))
|
||||
|
@ -221,6 +223,7 @@ dependencies {
|
|||
implementation(project(path: ":spring-boot-project:spring-boot-devtools"))
|
||||
implementation(project(path: ":spring-boot-project:spring-boot-docker-compose"))
|
||||
implementation(project(path: ":spring-boot-project:spring-boot-http"))
|
||||
implementation(project(path: ":spring-boot-project:spring-boot-http-client"))
|
||||
implementation(project(path: ":spring-boot-project:spring-boot-http-codec"))
|
||||
implementation(project(path: ":spring-boot-project:spring-boot-integration"))
|
||||
implementation(project(path: ":spring-boot-project:spring-boot-jackson"))
|
||||
|
|
|
@ -158,9 +158,9 @@ TIP: You can also change the xref:io/rest-client.adoc#io.rest-client.clienthttpr
|
|||
[[io.rest-client.restclient.ssl]]
|
||||
=== RestClient SSL Support
|
||||
|
||||
If you need custom SSL configuration on the javadoc:org.springframework.http.client.ClientHttpRequestFactory[] used by the javadoc:org.springframework.web.client.RestClient[], you can inject a javadoc:org.springframework.boot.autoconfigure.web.client.RestClientSsl[] instance that can be used with the builder's `apply` method.
|
||||
If you need custom SSL configuration on the javadoc:org.springframework.http.client.ClientHttpRequestFactory[] used by the javadoc:org.springframework.web.client.RestClient[], you can inject a javadoc:org.springframework.boot.http.client.rest.autoconfigure.RestClientSsl[] instance that can be used with the builder's `apply` method.
|
||||
|
||||
The javadoc:org.springframework.boot.autoconfigure.web.client.RestClientSsl[] interface provides access to any xref:features/ssl.adoc#features.ssl.bundles[SSL bundles] that you have defined in your `application.properties` or `application.yaml` file.
|
||||
The javadoc:org.springframework.boot.http.client.rest.autoconfigure.RestClientSsl[] interface provides access to any xref:features/ssl.adoc#features.ssl.bundles[SSL bundles] that you have defined in your `application.properties` or `application.yaml` file.
|
||||
|
||||
The following code shows a typical example:
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2023 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.
|
||||
|
@ -16,7 +16,7 @@
|
|||
|
||||
package org.springframework.boot.docs.io.restclient.restclient.ssl;
|
||||
|
||||
import org.springframework.boot.autoconfigure.web.client.RestClientSsl;
|
||||
import org.springframework.boot.http.client.rest.autoconfigure.RestClientSsl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestClient;
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
@ -18,7 +18,7 @@ package org.springframework.boot.docs.io.restclient.resttemplate.customization;
|
|||
|
||||
import java.time.Duration;
|
||||
|
||||
import org.springframework.boot.autoconfigure.web.client.RestTemplateBuilderConfigurer;
|
||||
import org.springframework.boot.http.client.rest.autoconfigure.RestTemplateBuilderConfigurer;
|
||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2023 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.
|
||||
|
@ -16,8 +16,8 @@
|
|||
|
||||
package org.springframework.boot.docs.io.restclient.restclient.ssl
|
||||
|
||||
import org.springframework.boot.autoconfigure.web.client.RestClientSsl
|
||||
import org.springframework.boot.docs.io.restclient.restclient.ssl.settings.Details
|
||||
import org.springframework.boot.http.client.rest.autoconfigure.RestClientSsl
|
||||
import org.springframework.stereotype.Service
|
||||
import org.springframework.web.client.RestClient
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -16,7 +16,7 @@
|
|||
|
||||
package org.springframework.boot.docs.io.restclient.resttemplate.customization
|
||||
|
||||
import org.springframework.boot.autoconfigure.web.client.RestTemplateBuilderConfigurer
|
||||
import org.springframework.boot.http.client.rest.autoconfigure.RestTemplateBuilderConfigurer
|
||||
import org.springframework.boot.web.client.RestTemplateBuilder
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
plugins {
|
||||
id "java-library"
|
||||
id "org.springframework.boot.auto-configuration"
|
||||
id "org.springframework.boot.configuration-properties"
|
||||
id "org.springframework.boot.deployed"
|
||||
id "org.springframework.boot.optional-dependencies"
|
||||
}
|
||||
|
||||
description = "Spring Boot HTTP Client"
|
||||
|
||||
dependencies {
|
||||
api(project(":spring-boot-project:spring-boot"))
|
||||
|
||||
implementation(project(":spring-boot-project:spring-boot-http"))
|
||||
|
||||
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
|
||||
optional("io.projectreactor.netty:reactor-netty-http")
|
||||
optional("org.apache.httpcomponents.client5:httpclient5")
|
||||
optional("org.eclipse.jetty:jetty-client")
|
||||
|
||||
testImplementation(project(":spring-boot-project:spring-boot-test"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||
|
||||
testRuntimeOnly("ch.qos.logback:logback-classic")
|
||||
testRuntimeOnly("jakarta.servlet:jakarta.servlet-api")
|
||||
testRuntimeOnly("org.springframework:spring-webflux")
|
||||
}
|
|
@ -14,13 +14,15 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.http.client;
|
||||
package org.springframework.boot.http.client.autoconfigure;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.http.client.ClientHttpRequestFactoryBuilder;
|
||||
import org.springframework.boot.http.client.ClientHttpRequestFactorySettings;
|
||||
import org.springframework.boot.http.client.HttpRedirects;
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
|
||||
/**
|
||||
|
@ -28,16 +30,64 @@ import org.springframework.http.client.ClientHttpRequestFactory;
|
|||
* {@link ClientHttpRequestFactory}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @since 3.5.0
|
||||
* @since 4.0.0
|
||||
* @see ClientHttpRequestFactorySettings
|
||||
*/
|
||||
public abstract class AbstractHttpRequestFactoryProperties extends AbstractHttpClientProperties {
|
||||
public abstract class AbstractHttpRequestFactoryProperties {
|
||||
|
||||
/**
|
||||
* Handling for HTTP redirects.
|
||||
*/
|
||||
private HttpRedirects redirects;
|
||||
|
||||
/**
|
||||
* Default connect timeout for a client HTTP request.
|
||||
*/
|
||||
private Duration connectTimeout;
|
||||
|
||||
/**
|
||||
* Default read timeout for a client HTTP request.
|
||||
*/
|
||||
private Duration readTimeout;
|
||||
|
||||
/**
|
||||
* Default SSL configuration for a client HTTP request.
|
||||
*/
|
||||
private final Ssl ssl = new Ssl();
|
||||
|
||||
/**
|
||||
* Default factory used for a client HTTP request.
|
||||
*/
|
||||
private Factory factory;
|
||||
|
||||
public HttpRedirects getRedirects() {
|
||||
return this.redirects;
|
||||
}
|
||||
|
||||
public void setRedirects(HttpRedirects redirects) {
|
||||
this.redirects = redirects;
|
||||
}
|
||||
|
||||
public Duration getConnectTimeout() {
|
||||
return this.connectTimeout;
|
||||
}
|
||||
|
||||
public void setConnectTimeout(Duration connectTimeout) {
|
||||
this.connectTimeout = connectTimeout;
|
||||
}
|
||||
|
||||
public Duration getReadTimeout() {
|
||||
return this.readTimeout;
|
||||
}
|
||||
|
||||
public void setReadTimeout(Duration readTimeout) {
|
||||
this.readTimeout = readTimeout;
|
||||
}
|
||||
|
||||
public Ssl getSsl() {
|
||||
return this.ssl;
|
||||
}
|
||||
|
||||
public Factory getFactory() {
|
||||
return this.factory;
|
||||
}
|
||||
|
@ -46,6 +96,26 @@ public abstract class AbstractHttpRequestFactoryProperties extends AbstractHttpC
|
|||
this.factory = factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* SSL configuration.
|
||||
*/
|
||||
public static class Ssl {
|
||||
|
||||
/**
|
||||
* SSL bundle to use.
|
||||
*/
|
||||
private String bundle;
|
||||
|
||||
public String getBundle() {
|
||||
return this.bundle;
|
||||
}
|
||||
|
||||
public void setBundle(String bundle) {
|
||||
this.bundle = bundle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Supported factory types.
|
||||
*/
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.http.client;
|
||||
package org.springframework.boot.http.client.autoconfigure;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Objects;
|
||||
|
@ -22,12 +22,12 @@ import java.util.function.Function;
|
|||
import java.util.function.Predicate;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.http.client.AbstractHttpClientProperties.Ssl;
|
||||
import org.springframework.boot.autoconfigure.http.client.AbstractHttpRequestFactoryProperties.Factory;
|
||||
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.http.client.HttpRedirects;
|
||||
import org.springframework.boot.http.client.autoconfigure.AbstractHttpRequestFactoryProperties.Factory;
|
||||
import org.springframework.boot.http.client.autoconfigure.AbstractHttpRequestFactoryProperties.Ssl;
|
||||
import org.springframework.boot.ssl.SslBundle;
|
||||
import org.springframework.boot.ssl.SslBundles;
|
||||
import org.springframework.util.StringUtils;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.http.client;
|
||||
package org.springframework.boot.http.client.autoconfigure;
|
||||
|
||||
import org.springframework.boot.http.client.ClientHttpRequestFactoryBuilder;
|
||||
|
||||
|
@ -24,7 +24,7 @@ import org.springframework.boot.http.client.ClientHttpRequestFactoryBuilder;
|
|||
*
|
||||
* @param <B> the builder type
|
||||
* @author Phillip Webb
|
||||
* @since 3.5.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public interface ClientHttpRequestFactoryBuilderCustomizer<B extends ClientHttpRequestFactoryBuilder<?>> {
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.http.client;
|
||||
package org.springframework.boot.http.client.autoconfigure;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -39,7 +39,7 @@ import org.springframework.http.client.ClientHttpRequestFactory;
|
|||
* {@link ClientHttpRequestFactoryBuilder} and {@link ClientHttpRequestFactorySettings}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @since 3.4.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
@AutoConfiguration(after = SslAutoConfiguration.class)
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.http.client;
|
||||
package org.springframework.boot.http.client.autoconfigure;
|
||||
|
||||
import java.time.Duration;
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.http.client;
|
||||
package org.springframework.boot.http.client.autoconfigure;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.http.client.reactive.ClientHttpConnectorSettings;
|
||||
|
@ -24,7 +24,7 @@ import org.springframework.boot.http.client.reactive.ClientHttpConnectorSettings
|
|||
* apply to Spring's blocking HTTP clients.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @since 3.5.0
|
||||
* @since 4.0.0
|
||||
* @see ClientHttpConnectorSettings
|
||||
*/
|
||||
@ConfigurationProperties("spring.http.client.settings")
|
|
@ -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.
|
||||
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.web.client;
|
||||
package org.springframework.boot.http.client.autoconfigure;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.boot.autoconfigure.condition.NoneNestedConditions;
|
|
@ -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.
|
||||
|
@ -17,4 +17,4 @@
|
|||
/**
|
||||
* Auto-configuration for client-side HTTP.
|
||||
*/
|
||||
package org.springframework.boot.autoconfigure.http.client;
|
||||
package org.springframework.boot.http.client.autoconfigure;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.web.client;
|
||||
package org.springframework.boot.http.client.rest.autoconfigure;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.web.client;
|
||||
package org.springframework.boot.http.client.rest.autoconfigure;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
@ -30,7 +30,7 @@ import org.springframework.web.client.RestClient;
|
|||
* HttpMessageConverters}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @since 3.2.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public class HttpMessageConvertersRestClientCustomizer implements RestClientCustomizer {
|
||||
|
|
@ -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.
|
||||
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.http.client;
|
||||
package org.springframework.boot.http.client.rest.autoconfigure;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.boot.autoconfigure.condition.NoneNestedConditions;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.web.client;
|
||||
package org.springframework.boot.http.client.rest.autoconfigure;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.AnyNestedCondition;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.web.client;
|
||||
package org.springframework.boot.http.client.rest.autoconfigure;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
@ -23,12 +23,12 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
|||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.http.client.HttpClientAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.ssl.SslAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration;
|
||||
import org.springframework.boot.http.autoconfigure.HttpMessageConverters;
|
||||
import org.springframework.boot.http.client.ClientHttpRequestFactoryBuilder;
|
||||
import org.springframework.boot.http.client.ClientHttpRequestFactorySettings;
|
||||
import org.springframework.boot.http.client.autoconfigure.HttpClientAutoConfiguration;
|
||||
import org.springframework.boot.ssl.SslBundles;
|
||||
import org.springframework.boot.web.client.RestClientCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
@ -48,7 +48,7 @@ import org.springframework.web.client.RestClient.Builder;
|
|||
*
|
||||
* @author Arjen Poutsma
|
||||
* @author Moritz Halbritter
|
||||
* @since 3.2.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
@AutoConfiguration(
|
||||
after = { HttpClientAutoConfiguration.class, TaskExecutionAutoConfiguration.class, SslAutoConfiguration.class })
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.web.client;
|
||||
package org.springframework.boot.http.client.rest.autoconfigure;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -29,7 +29,7 @@ import org.springframework.web.client.RestClient.Builder;
|
|||
* Configure {@link Builder RestClient.Builder} with sensible defaults.
|
||||
*
|
||||
* @author Moritz Halbritter
|
||||
* @since 3.2.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public class RestClientBuilderConfigurer {
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.web.client;
|
||||
package org.springframework.boot.http.client.rest.autoconfigure;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
@ -44,7 +44,7 @@ import org.springframework.web.client.RestClient;
|
|||
* consider using a {@link ClientHttpRequestFactoryBuilder}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @since 3.2.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public interface RestClientSsl {
|
||||
|
|
@ -14,17 +14,17 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.web.client;
|
||||
package org.springframework.boot.http.client.rest.autoconfigure;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.http.client.HttpClientAutoConfiguration;
|
||||
import org.springframework.boot.http.autoconfigure.HttpMessageConverters;
|
||||
import org.springframework.boot.http.client.ClientHttpRequestFactoryBuilder;
|
||||
import org.springframework.boot.http.client.ClientHttpRequestFactorySettings;
|
||||
import org.springframework.boot.http.client.autoconfigure.HttpClientAutoConfiguration;
|
||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||
import org.springframework.boot.web.client.RestTemplateCustomizer;
|
||||
import org.springframework.boot.web.client.RestTemplateRequestCustomizer;
|
||||
|
@ -39,7 +39,7 @@ import org.springframework.web.client.RestTemplate;
|
|||
*
|
||||
* @author Stephane Nicoll
|
||||
* @author Phillip Webb
|
||||
* @since 1.4.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
@AutoConfiguration(after = HttpClientAutoConfiguration.class)
|
||||
@ConditionalOnClass({ RestTemplate.class, HttpMessageConverters.class })
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.web.client;
|
||||
package org.springframework.boot.http.client.rest.autoconfigure;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
@ -32,7 +32,7 @@ import org.springframework.util.ObjectUtils;
|
|||
* Configure {@link RestTemplateBuilder} with sensible defaults.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @since 2.4.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public final class RestTemplateBuilderConfigurer {
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 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.
|
||||
|
@ -17,4 +17,4 @@
|
|||
/**
|
||||
* Auto-configuration for web clients.
|
||||
*/
|
||||
package org.springframework.boot.autoconfigure.web.client;
|
||||
package org.springframework.boot.http.client.rest.autoconfigure;
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"groups": [],
|
||||
"properties": []
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
org.springframework.boot.http.client.autoconfigure.HttpClientAutoConfiguration
|
||||
org.springframework.boot.http.client.rest.autoconfigure.RestClientAutoConfiguration
|
||||
org.springframework.boot.http.client.rest.autoconfigure.RestTemplateAutoConfiguration
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.http.client;
|
||||
package org.springframework.boot.http.client.autoconfigure;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
|
@ -14,17 +14,17 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.http.client;
|
||||
package org.springframework.boot.http.client.autoconfigure;
|
||||
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.http.client.AbstractHttpRequestFactoryProperties.Factory;
|
||||
import org.springframework.boot.http.client.HttpComponentsClientHttpRequestFactoryBuilder;
|
||||
import org.springframework.boot.http.client.JdkClientHttpRequestFactoryBuilder;
|
||||
import org.springframework.boot.http.client.JettyClientHttpRequestFactoryBuilder;
|
||||
import org.springframework.boot.http.client.ReactorClientHttpRequestFactoryBuilder;
|
||||
import org.springframework.boot.http.client.SimpleClientHttpRequestFactoryBuilder;
|
||||
import org.springframework.boot.http.client.autoconfigure.AbstractHttpRequestFactoryProperties.Factory;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.web.client;
|
||||
package org.springframework.boot.http.client.rest.autoconfigure;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.function.Consumer;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.web.client;
|
||||
package org.springframework.boot.http.client.rest.autoconfigure;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.web.client;
|
||||
package org.springframework.boot.http.client.rest.autoconfigure;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.List;
|
||||
|
@ -24,13 +24,13 @@ import org.junit.jupiter.api.condition.EnabledForJreRange;
|
|||
import org.junit.jupiter.api.condition.JRE;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.http.client.HttpClientAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration;
|
||||
import org.springframework.boot.http.autoconfigure.HttpMessageConverters;
|
||||
import org.springframework.boot.http.autoconfigure.HttpMessageConvertersAutoConfiguration;
|
||||
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.http.client.autoconfigure.HttpClientAutoConfiguration;
|
||||
import org.springframework.boot.ssl.SslBundle;
|
||||
import org.springframework.boot.ssl.SslBundles;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.web.client;
|
||||
package org.springframework.boot.http.client.rest.autoconfigure;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.web.client;
|
||||
package org.springframework.boot.http.client.rest.autoconfigure;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -23,9 +23,9 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
import org.springframework.beans.factory.support.BeanDefinitionOverrideException;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.http.client.HttpClientAutoConfiguration;
|
||||
import org.springframework.boot.http.autoconfigure.HttpMessageConverters;
|
||||
import org.springframework.boot.http.autoconfigure.HttpMessageConvertersAutoConfiguration;
|
||||
import org.springframework.boot.http.client.autoconfigure.HttpClientAutoConfiguration;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
|
||||
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
|
|
@ -5,6 +5,7 @@ plugins {
|
|||
description = "Starter for testing Spring Boot applications with libraries including JUnit Jupiter, Hamcrest and Mockito"
|
||||
|
||||
dependencies {
|
||||
api(project(":spring-boot-project:spring-boot-http-client"))
|
||||
api(project(":spring-boot-project:spring-boot-starters:spring-boot-starter"))
|
||||
api(project(":spring-boot-project:spring-boot-test"))
|
||||
api(project(":spring-boot-project:spring-boot-test-autoconfigure"))
|
||||
|
|
|
@ -53,6 +53,7 @@ dependencies {
|
|||
optional(project(":spring-boot-project:spring-boot-groovy-templates"))
|
||||
optional(project(":spring-boot-project:spring-boot-hateoas"))
|
||||
optional(project(":spring-boot-project:spring-boot-http"))
|
||||
optional(project(":spring-boot-project:spring-boot-http-client"))
|
||||
optional(project(":spring-boot-project:spring-boot-http-codec"))
|
||||
optional(project(":spring-boot-project:spring-boot-jackson"))
|
||||
optional(project(":spring-boot-project:spring-boot-jdbc"))
|
||||
|
|
|
@ -18,7 +18,6 @@ package org.springframework.boot.test.autoconfigure.web.client;
|
|||
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
|
||||
import org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration;
|
||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
@ -31,7 +30,7 @@ import org.springframework.web.client.RestTemplate;
|
|||
* @since 1.4.0
|
||||
* @see AutoConfigureMockRestServiceServer
|
||||
*/
|
||||
@AutoConfiguration(after = RestTemplateAutoConfiguration.class)
|
||||
@AutoConfiguration(afterName = "org.springframework.boot.http.client.rest.autoconfigure.RestTemplateAutoConfiguration")
|
||||
@ConditionalOnBooleanProperty("spring.test.webclient.register-rest-template")
|
||||
public class WebClientRestTemplateAutoConfiguration {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# AutoConfigureWebClient auto-configuration imports
|
||||
optional:org.springframework.boot.http.codec.autoconfigure.CodecsAutoConfiguration
|
||||
optional:org.springframework.boot.http.autoconfigure.HttpMessageConvertersAutoConfiguration
|
||||
optional:org.springframework.boot.http.client.rest.autoconfigure.RestClientAutoConfiguration
|
||||
optional:org.springframework.boot.http.client.rest.autoconfigure.RestTemplateAutoConfiguration
|
||||
optional:org.springframework.boot.http.codec.autoconfigure.CodecsAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration
|
||||
org.springframework.boot.test.autoconfigure.web.client.WebClientRestTemplateAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.web.client.RestClientAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration
|
|
@ -11,6 +11,7 @@ configurations {
|
|||
|
||||
dependencies {
|
||||
app project(path: ":spring-boot-project:spring-boot-dependencies", configuration: "mavenRepository")
|
||||
app project(path: ":spring-boot-project:spring-boot-http-client", configuration: "mavenRepository")
|
||||
app project(path: ":spring-boot-project:spring-boot-starters:spring-boot-starter", configuration: "mavenRepository")
|
||||
app project(path: ":spring-boot-project:spring-boot-starters:spring-boot-starter-actuator", configuration: "mavenRepository")
|
||||
app project(path: ":spring-boot-project:spring-boot-starters:spring-boot-starter-tomcat", configuration: "mavenRepository")
|
||||
|
|
|
@ -17,5 +17,6 @@ repositories {
|
|||
|
||||
dependencies {
|
||||
implementation(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES))
|
||||
implementation("org.springframework.boot:spring-boot-http-client")
|
||||
implementation("org.springframework.boot:spring-boot-starter-web")
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
@ -21,8 +21,8 @@ import java.util.Arrays;
|
|||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.WebApplicationType;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.web.client.RestClientSsl;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.http.client.rest.autoconfigure.RestClientSsl;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.Assert;
|
||||
|
|
Loading…
Reference in New Issue