This commit is contained in:
Stéphane Nicoll
2025-11-17 09:42:06 +01:00
parent 992c905153
commit 2e4566bd3d
3 changed files with 6 additions and 18 deletions
@@ -23,7 +23,7 @@ import org.jspecify.annotations.Nullable;
import org.springframework.boot.ssl.SslBundle;
/**
* Settings that can be applied when creating a imperative or reactive HTTP client.
* Settings that can be applied when creating an imperative or reactive HTTP client.
*
* @param redirects the follow redirect strategy to use or null to redirect whenever the
* underlying library allows it
@@ -38,14 +38,6 @@ public record HttpClientSettings(@Nullable HttpRedirects redirects, @Nullable Du
private static final HttpClientSettings defaults = new HttpClientSettings(null, null, null, null);
public HttpClientSettings(@Nullable HttpRedirects redirects, @Nullable Duration connectTimeout,
@Nullable Duration readTimeout, @Nullable SslBundle sslBundle) {
this.redirects = redirects;
this.connectTimeout = connectTimeout;
this.readTimeout = readTimeout;
this.sslBundle = sslBundle;
}
/**
* Return a new {@link HttpClientSettings} instance with an updated connect timeout
* setting.
@@ -36,16 +36,12 @@ import org.springframework.context.annotation.Bean;
@EnableConfigurationProperties(HttpClientsProperties.class)
public final class HttpClientAutoConfiguration {
private final HttpClientSettingsPropertyMapper propertyMapper;
HttpClientAutoConfiguration(ObjectProvider<SslBundles> sslBundles) {
this.propertyMapper = new HttpClientSettingsPropertyMapper(sslBundles.getIfAvailable(), null);
}
@Bean
@ConditionalOnMissingBean
HttpClientSettings httpClientSettings(HttpClientsProperties properties) {
return this.propertyMapper.map(properties);
HttpClientSettings httpClientSettings(ObjectProvider<SslBundles> sslBundles, HttpClientsProperties properties) {
HttpClientSettingsPropertyMapper propertyMapper = new HttpClientSettingsPropertyMapper(
sslBundles.getIfAvailable(), null);
return propertyMapper.map(properties);
}
}
@@ -57,7 +57,7 @@ public class HttpClientSettingsPropertyMapper {
return settings.orElse(this.settings);
}
private @Nullable SslBundle getSslBundle(String name) {
private SslBundle getSslBundle(String name) {
Assert.state(this.sslBundles != null, "No 'sslBundles' available");
return this.sslBundles.getBundle(name);
}