Create spring-boot-http-client-reactive module

This commit is contained in:
Andy Wilkinson
2025-05-07 11:31:34 +01:00
committed by Phillip Webb
parent 4471c0e644
commit 6e04fc0910
61 changed files with 95 additions and 382 deletions

View File

@@ -79,6 +79,7 @@ include "spring-boot-project:spring-boot-hateoas"
include "spring-boot-project:spring-boot-hazelcast"
include "spring-boot-project:spring-boot-http-converter"
include "spring-boot-project:spring-boot-http-client"
include "spring-boot-project:spring-boot-http-client-reactive"
include "spring-boot-project:spring-boot-http-codec"
include "spring-boot-project:spring-boot-integration"
include "spring-boot-project:spring-boot-integration-tests"

View File

@@ -42,6 +42,7 @@ dependencies {
optional(project(":spring-boot-project:spring-boot-hazelcast"))
optional(project(":spring-boot-project:spring-boot-http-converter"))
optional(project(":spring-boot-project:spring-boot-http-client"))
optional(project(":spring-boot-project:spring-boot-http-client-reactive"))
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"))

View File

@@ -31,7 +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.reactive.function.client.WebClientAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -50,10 +49,9 @@ import org.springframework.core.annotation.Order;
* @author Moritz Halbritter
* @since 3.0.0
*/
@AutoConfiguration(
after = { ObservationAutoConfiguration.class, CompositeMeterRegistryAutoConfiguration.class,
WebClientAutoConfiguration.class },
afterName = { "org.springframework.boot.http.client.rest.autoconfigure.RestClientAutoConfiguration",
@AutoConfiguration(after = { ObservationAutoConfiguration.class, CompositeMeterRegistryAutoConfiguration.class },
afterName = { "org.springframework.boot.http.client.reactive.web.autoconfigure.WebClientAutoConfiguration",
"org.springframework.boot.http.client.rest.autoconfigure.RestClientAutoConfiguration",
"org.springframework.boot.http.client.rest.autoconfigure.RestTemplateAutoConfiguration" })
@ConditionalOnClass(Observation.class)
@ConditionalOnBean(ObservationRegistry.class)

View File

@@ -32,7 +32,7 @@ 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.reactive.function.client.WebClientAutoConfiguration;
import org.springframework.boot.http.client.reactive.web.autoconfigure.WebClientAutoConfiguration;
import org.springframework.boot.http.converter.autoconfigure.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration;
import org.springframework.boot.security.autoconfigure.reactive.ReactiveSecurityAutoConfiguration;

View File

@@ -50,7 +50,7 @@ import org.springframework.boot.actuate.endpoint.web.WebOperationRequestPredicat
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.reactive.function.client.WebClientAutoConfiguration;
import org.springframework.boot.http.client.reactive.web.autoconfigure.WebClientAutoConfiguration;
import org.springframework.boot.http.converter.autoconfigure.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration;
import org.springframework.boot.security.autoconfigure.reactive.ReactiveSecurityAutoConfiguration;

View File

@@ -30,7 +30,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.reactive.client.ObservationWebClientCustomizer;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration;
import org.springframework.boot.http.client.reactive.web.autoconfigure.WebClientAutoConfiguration;
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.boot.test.system.CapturedOutput;

View File

@@ -1,79 +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.web.reactive.function.client;
import java.util.List;
import reactor.netty.http.client.HttpClient;
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.http.client.reactive.ClientHttpConnectorBuilderCustomizer;
import org.springframework.boot.http.client.reactive.ReactorClientHttpConnectorBuilder;
import org.springframework.boot.reactor.netty.autoconfigure.ReactorNettyConfigurations.ReactorResourceFactoryConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.core.annotation.Order;
import org.springframework.http.client.ReactorResourceFactory;
import org.springframework.web.reactive.function.client.WebClient;
/**
* Deprecated {@link EnableAutoConfiguration Auto-configuration} for
* {@link ReactorNettyHttpClientMapper}.
*
* @author Brian Clozel
* @author Phillip Webb
* @since 2.1.0
* @deprecated since 3.5.0 for removal in 4.0.0 in favor of
* {@link org.springframework.boot.autoconfigure.http.client.reactive.ClientHttpConnectorAutoConfiguration}
* and to align with the deprecation of {@link ReactorNettyHttpClientMapper}
*/
@AutoConfiguration
@ConditionalOnClass(WebClient.class)
@Deprecated(since = "3.5.0", forRemoval = true)
public class ClientHttpConnectorAutoConfiguration {
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(HttpClient.class)
@Import(ReactorResourceFactoryConfiguration.class)
@SuppressWarnings("removal")
static class ReactorNetty {
@Bean
@Order(0)
ClientHttpConnectorBuilderCustomizer<ReactorClientHttpConnectorBuilder> reactorNettyHttpClientMapperClientHttpConnectorBuilderCustomizer(
ReactorResourceFactory reactorResourceFactory,
ObjectProvider<ReactorNettyHttpClientMapper> mapperProvider) {
return applyMappers(mapperProvider.orderedStream().toList());
}
private ClientHttpConnectorBuilderCustomizer<ReactorClientHttpConnectorBuilder> applyMappers(
List<ReactorNettyHttpClientMapper> mappers) {
return (builder) -> {
for (ReactorNettyHttpClientMapper mapper : mappers) {
builder = builder.withHttpClientCustomizer(mapper::configure);
}
return builder;
};
}
}
}

View File

@@ -1,77 +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.web.reactive.function.client;
import java.util.Collection;
import reactor.netty.http.client.HttpClient;
import org.springframework.boot.autoconfigure.http.client.reactive.ClientHttpConnectorBuilderCustomizer;
import org.springframework.boot.http.client.reactive.ClientHttpConnectorBuilder;
import org.springframework.http.client.reactive.ReactorClientHttpConnector;
import org.springframework.util.Assert;
/**
* Mapper that allows for custom modification of a {@link HttpClient} before it is used as
* the basis for a {@link ReactorClientHttpConnector}.
*
* @author Brian Clozel
* @author Phillip Webb
* @since 2.3.0
* @deprecated since 3.5.0 for removal in 4.0.0 in favor of
* {@link ClientHttpConnectorBuilderCustomizer} or declaring a pre-configured
* {@link ClientHttpConnectorBuilder} bean
*/
@FunctionalInterface
@Deprecated(since = "3.5.0", forRemoval = true)
public interface ReactorNettyHttpClientMapper {
/**
* Configure the given {@link HttpClient} and return the newly created instance.
* @param httpClient the client to configure
* @return the new client instance
*/
HttpClient configure(HttpClient httpClient);
/**
* Return a new {@link ReactorNettyHttpClientMapper} composed of the given mappers.
* @param mappers the mappers to compose
* @return a composed {@link ReactorNettyHttpClientMapper} instance
* @since 3.1.1
*/
static ReactorNettyHttpClientMapper of(Collection<ReactorNettyHttpClientMapper> mappers) {
Assert.notNull(mappers, "'mappers' must not be null");
return of(mappers.toArray(ReactorNettyHttpClientMapper[]::new));
}
/**
* Return a new {@link ReactorNettyHttpClientMapper} composed of the given mappers.
* @param mappers the mappers to compose
* @return a composed {@link ReactorNettyHttpClientMapper} instance
* @since 3.1.1
*/
static ReactorNettyHttpClientMapper of(ReactorNettyHttpClientMapper... mappers) {
Assert.notNull(mappers, "'mappers' must not be null");
return (httpClient) -> {
for (ReactorNettyHttpClientMapper mapper : mappers) {
httpClient = mapper.configure(httpClient);
}
return httpClient;
};
}
}

View File

@@ -1,6 +1,2 @@
org.springframework.boot.autoconfigure.http.client.reactive.ClientHttpConnectorAutoConfiguration
org.springframework.boot.autoconfigure.http.client.reactive.service.ReactiveHttpServiceClientAutoConfiguration
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
org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration

View File

@@ -1,62 +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.web.reactive.function.client;
import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.http.client.reactive.ClientHttpConnector;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link ClientHttpConnectorAutoConfiguration}
*
* @author Brian Clozel
*/
@SuppressWarnings("removal")
class ClientHttpConnectorAutoConfigurationTests {
@Test
void shouldApplyReactorNettyHttpClientMapper() {
new ReactiveWebApplicationContextRunner().withConfiguration(AutoConfigurations.of(
ClientHttpConnectorAutoConfiguration.class,
org.springframework.boot.autoconfigure.http.client.reactive.ClientHttpConnectorAutoConfiguration.class))
.withUserConfiguration(CustomReactorNettyHttpClientMapper.class)
.run((context) -> {
context.getBean(ClientHttpConnector.class);
assertThat(CustomReactorNettyHttpClientMapper.called).isTrue();
});
}
static class CustomReactorNettyHttpClientMapper {
static boolean called = false;
@Bean
ReactorNettyHttpClientMapper clientMapper() {
return (client) -> {
called = true;
return client.baseUrl("/test");
};
}
}
}

View File

@@ -1,100 +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.web.reactive.function.client;
import java.util.Collection;
import java.util.List;
import org.junit.jupiter.api.Test;
import reactor.netty.http.client.HttpClient;
import reactor.netty.http.client.HttpClientConfig;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
/**
* Tests for {@link ReactorNettyHttpClientMapper}.
*
* @author Phillip Webb
*/
@SuppressWarnings("removal")
class ReactorNettyHttpClientMapperTests {
@Test
void ofWithCollectionCreatesComposite() {
ReactorNettyHttpClientMapper one = (httpClient) -> new TestHttpClient(httpClient, "1");
ReactorNettyHttpClientMapper two = (httpClient) -> new TestHttpClient(httpClient, "2");
ReactorNettyHttpClientMapper three = (httpClient) -> new TestHttpClient(httpClient, "3");
ReactorNettyHttpClientMapper compose = ReactorNettyHttpClientMapper.of(List.of(one, two, three));
TestHttpClient httpClient = (TestHttpClient) compose.configure(new TestHttpClient());
assertThat(httpClient.getContent()).isEqualTo("123");
}
@Test
void ofWhenCollectionIsNullThrowsException() {
Collection<ReactorNettyHttpClientMapper> mappers = null;
assertThatIllegalArgumentException().isThrownBy(() -> ReactorNettyHttpClientMapper.of(mappers))
.withMessage("'mappers' must not be null");
}
@Test
void ofWithArrayCreatesComposite() {
ReactorNettyHttpClientMapper one = (httpClient) -> new TestHttpClient(httpClient, "1");
ReactorNettyHttpClientMapper two = (httpClient) -> new TestHttpClient(httpClient, "2");
ReactorNettyHttpClientMapper three = (httpClient) -> new TestHttpClient(httpClient, "3");
ReactorNettyHttpClientMapper compose = ReactorNettyHttpClientMapper.of(one, two, three);
TestHttpClient httpClient = (TestHttpClient) compose.configure(new TestHttpClient());
assertThat(httpClient.getContent()).isEqualTo("123");
}
@Test
void ofWhenArrayIsNullThrowsException() {
ReactorNettyHttpClientMapper[] mappers = null;
assertThatIllegalArgumentException().isThrownBy(() -> ReactorNettyHttpClientMapper.of(mappers))
.withMessage("'mappers' must not be null");
}
private static class TestHttpClient extends HttpClient {
private final String content;
TestHttpClient() {
this.content = "";
}
TestHttpClient(HttpClient httpClient, String content) {
this.content = (httpClient instanceof TestHttpClient testHttpClient) ? testHttpClient.content + content
: content;
}
@Override
public HttpClientConfig configuration() {
throw new UnsupportedOperationException("Auto-generated method stub");
}
@Override
protected HttpClient duplicate() {
throw new UnsupportedOperationException("Auto-generated method stub");
}
String getContent() {
return this.content;
}
}
}

View File

@@ -2014,6 +2014,7 @@ bom {
"spring-boot-hazelcast",
"spring-boot-http-converter",
"spring-boot-http-client",
"spring-boot-http-client-reactive",
"spring-boot-http-codec",
"spring-boot-integration",
"spring-boot-jackson",

View File

@@ -92,6 +92,7 @@ dependencies {
autoConfiguration(project(path: ":spring-boot-project:spring-boot-hazelcast", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-http-converter", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-http-client", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-http-client-reactive", 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"))
@@ -173,6 +174,7 @@ dependencies {
configurationProperties(project(path: ":spring-boot-project:spring-boot-hazelcast", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-http-converter", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-http-client", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-http-client-reactive", 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"))
@@ -231,6 +233,7 @@ dependencies {
implementation(project(path: ":spring-boot-project:spring-boot-docker-compose"))
implementation(project(path: ":spring-boot-project:spring-boot-http-converter"))
implementation(project(path: ":spring-boot-project:spring-boot-http-client"))
implementation(project(path: ":spring-boot-project:spring-boot-http-client-reactive"))
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"))

View File

@@ -18,7 +18,7 @@ package org.springframework.boot.docs.io.restclient.webclient.ssl;
import reactor.core.publisher.Mono;
import org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientSsl;
import org.springframework.boot.http.client.reactive.web.autoconfigure.WebClientSsl;
import org.springframework.stereotype.Service;
import org.springframework.web.reactive.function.client.WebClient;

View File

@@ -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.webclient.ssl
import org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientSsl
import org.springframework.boot.http.client.reactive.web.autoconfigure.WebClientSsl
import org.springframework.stereotype.Service
import org.springframework.web.reactive.function.client.WebClient
import reactor.core.publisher.Mono

View File

@@ -0,0 +1,29 @@
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 Reactive HTTP Client"
dependencies {
api(project(":spring-boot-project:spring-boot"))
api("org.springframework:spring-web")
implementation(project(":spring-boot-project:spring-boot-http-codec"))
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
optional(project(":spring-boot-project:spring-boot-reactor-netty"))
optional("org.apache.httpcomponents.client5:httpclient5")
optional("org.apache.httpcomponents.core5:httpcore5-reactive")
optional("org.eclipse.jetty:jetty-reactive-httpclient")
optional("org.springframework:spring-webflux")
testImplementation(project(":spring-boot-project:spring-boot-test"))
testImplementation(project(":spring-boot-project:spring-boot-tomcat"))
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
testRuntimeOnly("ch.qos.logback:logback-classic")
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.http.client.reactive;
package org.springframework.boot.http.client.reactive.autoconfigure;
import java.time.Duration;
import java.util.function.Supplier;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.http.client.reactive;
package org.springframework.boot.http.client.reactive.autoconfigure;
import java.util.List;
@@ -45,7 +45,7 @@ import org.springframework.http.client.reactive.ClientHttpConnector;
* {@link ClientHttpConnectorBuilder} and {@link ClientHttpConnectorSettings}.
*
* @author Phillip Webb
* @since 3.5.0
* @since 4.0.0
*/
@AutoConfiguration(after = SslAutoConfiguration.class)
@ConditionalOnClass({ ClientHttpConnector.class, Mono.class })

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.http.client.reactive;
package org.springframework.boot.http.client.reactive.autoconfigure;
import org.springframework.boot.http.client.reactive.ClientHttpConnectorBuilder;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.http.client.reactive;
package org.springframework.boot.http.client.reactive.autoconfigure;
import java.time.Duration;
import java.util.Objects;
@@ -22,11 +22,11 @@ import java.util.function.Function;
import java.util.function.Predicate;
import org.springframework.beans.factory.ObjectFactory;
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;
import org.springframework.boot.http.client.reactive.autoconfigure.AbstractClientHttpConnectorProperties.Connector;
import org.springframework.boot.http.client.reactive.autoconfigure.AbstractClientHttpConnectorProperties.Ssl;
import org.springframework.boot.ssl.SslBundle;
import org.springframework.boot.ssl.SslBundles;
import org.springframework.util.StringUtils;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.http.client.reactive;
package org.springframework.boot.http.client.reactive.autoconfigure;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.http.client.reactive;
package org.springframework.boot.http.client.reactive.autoconfigure;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.http.client.reactive.ClientHttpConnectorSettings;

View File

@@ -17,4 +17,4 @@
/**
* Auto-configuration for client-side reactive HTTP.
*/
package org.springframework.boot.autoconfigure.http.client.reactive;
package org.springframework.boot.http.client.reactive.autoconfigure;

View File

@@ -14,13 +14,13 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.http.client.reactive.service;
package org.springframework.boot.http.client.reactive.service.autoconfigure;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.boot.autoconfigure.http.client.reactive.AbstractClientHttpConnectorProperties;
import org.springframework.boot.http.client.reactive.autoconfigure.AbstractClientHttpConnectorProperties;
/**
* {@link AbstractClientHttpConnectorProperties} for reactive HTTP Service clients.

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.http.client.reactive.service;
package org.springframework.boot.http.client.reactive.service.autoconfigure;
import java.util.LinkedHashMap;
import java.util.Map;

View File

@@ -14,19 +14,19 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.http.client.reactive.service;
package org.springframework.boot.http.client.reactive.service.autoconfigure;
import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.http.client.reactive.ClientHttpConnectorAutoConfiguration;
import org.springframework.boot.autoconfigure.http.client.reactive.HttpReactiveClientProperties;
import org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.http.client.reactive.ClientHttpConnectorBuilder;
import org.springframework.boot.http.client.reactive.ClientHttpConnectorSettings;
import org.springframework.boot.http.client.reactive.autoconfigure.ClientHttpConnectorAutoConfiguration;
import org.springframework.boot.http.client.reactive.autoconfigure.HttpReactiveClientProperties;
import org.springframework.boot.http.client.reactive.web.autoconfigure.WebClientAutoConfiguration;
import org.springframework.boot.ssl.SslBundles;
import org.springframework.boot.web.reactive.function.client.WebClientCustomizer;
import org.springframework.context.annotation.Bean;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.http.client.reactive.service;
package org.springframework.boot.http.client.reactive.service.autoconfigure;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.web.client.RestClientCustomizer;

View File

@@ -14,18 +14,18 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.http.client.reactive.service;
package org.springframework.boot.http.client.reactive.service.autoconfigure;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.http.client.reactive.ClientHttpConnectors;
import org.springframework.boot.autoconfigure.http.client.reactive.HttpReactiveClientProperties;
import org.springframework.boot.context.properties.PropertyMapper;
import org.springframework.boot.http.client.reactive.ClientHttpConnectorBuilder;
import org.springframework.boot.http.client.reactive.ClientHttpConnectorSettings;
import org.springframework.boot.http.client.reactive.autoconfigure.ClientHttpConnectors;
import org.springframework.boot.http.client.reactive.autoconfigure.HttpReactiveClientProperties;
import org.springframework.boot.ssl.SslBundles;
import org.springframework.core.Ordered;
import org.springframework.http.HttpHeaders;

View File

@@ -17,4 +17,4 @@
/**
* Auto-Configuration for Spring's Reactive HTTP Service Interface Clients.
*/
package org.springframework.boot.autoconfigure.http.client.reactive.service;
package org.springframework.boot.http.client.reactive.service.autoconfigure;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.web.reactive.function.client;
package org.springframework.boot.http.client.reactive.web.autoconfigure;
import java.util.function.Consumer;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.web.reactive.function.client;
package org.springframework.boot.http.client.reactive.web.autoconfigure;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@@ -23,10 +23,11 @@ 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.reactive.ClientHttpConnectorAutoConfiguration;
import org.springframework.boot.http.client.reactive.ClientHttpConnectorBuilder;
import org.springframework.boot.http.client.reactive.ClientHttpConnectorSettings;
import org.springframework.boot.http.client.reactive.autoconfigure.ClientHttpConnectorAutoConfiguration;
import org.springframework.boot.http.codec.CodecCustomizer;
import org.springframework.boot.http.codec.autoconfigure.CodecsAutoConfiguration;
import org.springframework.boot.ssl.SslBundles;
import org.springframework.boot.web.reactive.function.client.WebClientCustomizer;
import org.springframework.context.annotation.Bean;
@@ -49,8 +50,7 @@ import org.springframework.web.reactive.function.client.WebClient;
* @author Phillip Webb
* @since 2.0.0
*/
@AutoConfiguration(after = ClientHttpConnectorAutoConfiguration.class,
afterName = "org.springframework.boot.http.codec.autoconfigure.CodecsAutoConfiguration")
@AutoConfiguration(after = { ClientHttpConnectorAutoConfiguration.class, CodecsAutoConfiguration.class })
@ConditionalOnClass(WebClient.class)
public class WebClientAutoConfiguration {

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.web.reactive.function.client;
package org.springframework.boot.http.client.reactive.web.autoconfigure;
import java.util.List;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.web.reactive.function.client;
package org.springframework.boot.http.client.reactive.web.autoconfigure;
import java.util.function.Consumer;

View File

@@ -17,4 +17,4 @@
/**
* Auto-configuration for Spring Framework's functional web client.
*/
package org.springframework.boot.autoconfigure.web.reactive.function.client;
package org.springframework.boot.http.client.reactive.web.autoconfigure;

View File

@@ -0,0 +1,3 @@
org.springframework.boot.http.client.reactive.autoconfigure.ClientHttpConnectorAutoConfiguration
org.springframework.boot.http.client.reactive.service.autoconfigure.ReactiveHttpServiceClientAutoConfiguration
org.springframework.boot.http.client.reactive.web.autoconfigure.WebClientAutoConfiguration

View File

@@ -40,7 +40,6 @@ import org.springframework.boot.ssl.SslOptions;
import org.springframework.boot.ssl.jks.JksSslStoreBundle;
import org.springframework.boot.ssl.jks.JksSslStoreDetails;
import org.springframework.boot.testsupport.classpath.resources.WithPackageResources;
import org.springframework.boot.testsupport.web.servlet.DirtiesUrlFactories;
import org.springframework.boot.tomcat.servlet.TomcatServletWebServerFactory;
import org.springframework.boot.web.server.Ssl;
import org.springframework.boot.web.server.Ssl.ClientAuth;
@@ -63,7 +62,6 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @author Phillip Webb
* @author Andy Wilkinson
*/
@DirtiesUrlFactories
abstract class AbstractClientHttpConnectorBuilderTests<T extends ClientHttpConnector> {
private static final Function<HttpMethod, HttpStatus> ALWAYS_FOUND = (method) -> HttpStatus.FOUND;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.http.client.reactive;
package org.springframework.boot.http.client.reactive.autoconfigure;
import java.time.Duration;
import java.util.ArrayList;

View File

@@ -14,18 +14,18 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.http.client.reactive;
package org.springframework.boot.http.client.reactive.autoconfigure;
import java.time.Duration;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.boot.autoconfigure.http.client.reactive.AbstractClientHttpConnectorProperties.Connector;
import org.springframework.boot.http.client.HttpRedirects;
import org.springframework.boot.http.client.reactive.ClientHttpConnectorSettings;
import org.springframework.boot.http.client.reactive.JettyClientHttpConnectorBuilder;
import org.springframework.boot.http.client.reactive.ReactorClientHttpConnectorBuilder;
import org.springframework.boot.http.client.reactive.autoconfigure.AbstractClientHttpConnectorProperties.Connector;
import org.springframework.boot.ssl.DefaultSslBundleRegistry;
import org.springframework.boot.ssl.SslBundle;
import org.springframework.boot.ssl.SslBundles;

View File

@@ -14,16 +14,16 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.http.client.reactive;
package org.springframework.boot.http.client.reactive.autoconfigure;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.http.client.reactive.AbstractClientHttpConnectorProperties.Connector;
import org.springframework.boot.http.client.reactive.HttpComponentsClientHttpConnectorBuilder;
import org.springframework.boot.http.client.reactive.JdkClientHttpConnectorBuilder;
import org.springframework.boot.http.client.reactive.JettyClientHttpConnectorBuilder;
import org.springframework.boot.http.client.reactive.ReactorClientHttpConnectorBuilder;
import org.springframework.boot.http.client.reactive.autoconfigure.AbstractClientHttpConnectorProperties.Connector;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.http.client.reactive.service;
package org.springframework.boot.http.client.reactive.service.autoconfigure;
import java.time.Duration;
import java.util.List;
@@ -22,10 +22,10 @@ import java.util.Map;
import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.http.client.reactive.AbstractClientHttpConnectorProperties.Connector;
import org.springframework.boot.autoconfigure.http.client.reactive.service.ReactiveHttpClientServiceProperties.Group;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.http.client.HttpRedirects;
import org.springframework.boot.http.client.reactive.autoconfigure.AbstractClientHttpConnectorProperties.Connector;
import org.springframework.boot.http.client.reactive.service.autoconfigure.ReactiveHttpClientServiceProperties.Group;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.mock.env.MockEnvironment;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.http.client.reactive.service;
package org.springframework.boot.http.client.reactive.service.autoconfigure;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
@@ -28,11 +28,11 @@ import org.junit.jupiter.api.Test;
import org.springframework.aop.Advisor;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.http.client.reactive.ClientHttpConnectorAutoConfiguration;
import org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration;
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.boot.http.client.reactive.autoconfigure.ClientHttpConnectorAutoConfiguration;
import org.springframework.boot.http.client.reactive.web.autoconfigure.WebClientAutoConfiguration;
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
import org.springframework.boot.web.reactive.function.client.WebClientCustomizer;
import org.springframework.context.annotation.Bean;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.web.reactive.function.client;
package org.springframework.boot.http.client.reactive.web.autoconfigure;
import org.junit.jupiter.api.Test;
@@ -42,7 +42,7 @@ class WebClientAutoConfigurationTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(
org.springframework.boot.autoconfigure.http.client.reactive.ClientHttpConnectorAutoConfiguration.class,
org.springframework.boot.http.client.reactive.autoconfigure.ClientHttpConnectorAutoConfiguration.class,
WebClientAutoConfiguration.class, SslAutoConfiguration.class));
@Test

View File

@@ -12,10 +12,9 @@ dependencies {
api(project(":spring-boot-project:spring-boot"))
api("org.springframework:spring-web")
implementation("org.springframework:spring-webflux")
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
optional(project(":spring-boot-project:spring-boot-jackson"))
optional("org.springframework:spring-webflux")
testImplementation(project(":spring-boot-project:spring-boot-test"))
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))

View File

@@ -6,6 +6,7 @@ description = "Starter for testing Spring Boot applications with libraries inclu
dependencies {
api(project(":spring-boot-project:spring-boot-http-client"))
api(project(":spring-boot-project:spring-boot-http-client-reactive"))
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"))

View File

@@ -62,6 +62,7 @@ dependencies {
optional(project(":spring-boot-project:spring-boot-hateoas"))
optional(project(":spring-boot-project:spring-boot-http-converter"))
optional(project(":spring-boot-project:spring-boot-http-client"))
optional(project(":spring-boot-project:spring-boot-http-client-reactive"))
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"))

View File

@@ -1,7 +1,7 @@
# AutoConfigureWebClient auto-configuration imports
optional:org.springframework.boot.http.converter.autoconfigure.HttpMessageConvertersAutoConfiguration
optional:org.springframework.boot.http.client.reactive.web.WebClientAutoConfiguration
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
optional:org.springframework.boot.http.converter.autoconfigure.HttpMessageConvertersAutoConfiguration
org.springframework.boot.test.autoconfigure.web.client.WebClientRestTemplateAutoConfiguration