Skip to content

Commit

Permalink
Use latest way to set factory
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Jan 3, 2025
1 parent b670292 commit 3fc728d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.http.client.ClientHttpRequestFactoryBuilder;
import org.springframework.boot.web.client.RestClientCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpRequest;
import org.springframework.http.MediaType;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.util.StreamUtils;

@Configuration(proxyBeanMethods = false)
Expand All @@ -26,7 +26,8 @@ public class LoggingConfig {
@Bean
RestClientCustomizer restClientCustomizer() {
return restClientBuilder -> restClientBuilder
.requestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()))
.requestFactory(new BufferingClientHttpRequestFactory(
ClientHttpRequestFactoryBuilder.httpComponents().build()))
.requestInterceptor((request, body, execution) -> {
logRequest(request, body);
ClientHttpResponse response = execution.execute(request, body);
Expand Down

0 comments on commit 3fc728d

Please sign in to comment.