mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Polish
This commit is contained in:
+1
-9
@@ -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.
|
||||
|
||||
+4
-8
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user