Skip to content

Commit

Permalink
Bumping versions
Browse files Browse the repository at this point in the history
  • Loading branch information
spring-builds committed Nov 3, 2023
1 parent ed3349b commit 942cc69
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,17 @@ public CloseableHttpClient httpClient5(HttpClientConnectionManager connectionMan
FeignHttpClientProperties httpClientProperties,
ObjectProvider<List<HttpClientBuilderCustomizer>> customizerProvider) {
HttpClientBuilder httpClientBuilder = HttpClients.custom().disableCookieManagement().useSystemProperties()
.setConnectionManager(connectionManager).evictExpiredConnections()
.setDefaultRequestConfig(RequestConfig.custom()
.setConnectTimeout(
Timeout.of(httpClientProperties.getConnectionTimeout(), TimeUnit.MILLISECONDS))
.setRedirectsEnabled(httpClientProperties.isFollowRedirects())
.setConnectionRequestTimeout(
Timeout.of(httpClientProperties.getHc5().getConnectionRequestTimeout(),
httpClientProperties.getHc5().getConnectionRequestTimeoutUnit()))
.build());

customizerProvider.getIfAvailable(List::of)
.forEach(c -> c.customize(httpClientBuilder));
.setConnectionManager(connectionManager).evictExpiredConnections()
.setDefaultRequestConfig(RequestConfig.custom()
.setConnectTimeout(
Timeout.of(httpClientProperties.getConnectionTimeout(), TimeUnit.MILLISECONDS))
.setRedirectsEnabled(httpClientProperties.isFollowRedirects())
.setConnectionRequestTimeout(
Timeout.of(httpClientProperties.getHc5().getConnectionRequestTimeout(),
httpClientProperties.getHc5().getConnectionRequestTimeoutUnit()))
.build());

customizerProvider.getIfAvailable(List::of).forEach(c -> c.customize(httpClientBuilder));

httpClient5 = httpClientBuilder.build();
return httpClient5;
Expand Down Expand Up @@ -156,7 +155,8 @@ public X509Certificate[] getAcceptedIssuers() {
}

/**
* Callback interface that customize {@link HttpClientBuilder} objects before HttpClient created.
* Callback interface that customize {@link HttpClientBuilder} objects before
* HttpClient created.
*
* @author Kwangyong Kim
* @since 4.1.0
Expand All @@ -170,4 +170,5 @@ public interface HttpClientBuilderCustomizer {
void customize(HttpClientBuilder builder);

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,8 @@ void shouldNotInstantiateHttpClient5ByWhenDependenciesPresentButPropertyDisabled

@Test
void shouldInstantiateHttpClient5ByUsingHttpClientBuilderCustomizer() {
ConfigurableApplicationContext context = new SpringApplicationBuilder()
.web(WebApplicationType.NONE)
.sources(FeignAutoConfiguration.class, Config.class)
.run();
ConfigurableApplicationContext context = new SpringApplicationBuilder().web(WebApplicationType.NONE)
.sources(FeignAutoConfiguration.class, Config.class).run();

CloseableHttpClient httpClient = context.getBean(CloseableHttpClient.class);
assertThat(httpClient).isNotNull();
Expand All @@ -99,9 +97,12 @@ void shouldInstantiateHttpClient5ByUsingHttpClientBuilderCustomizer() {

@Configuration
static class Config {

@Bean
HttpClientBuilderCustomizer customizer() {
return Mockito.mock(HttpClientBuilderCustomizer.class);
}

}

}

0 comments on commit 942cc69

Please sign in to comment.