Last active
January 9, 2022 16:33
-
-
Save Linkit123/3cd91cca854d5232bca720aef66a27b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dvtt.demo.coredemo.config; | |
import com.dvtt.demo.coredemo.interceptor.RestTemplateInterceptor; | |
import lombok.AllArgsConstructor; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.http.client.BufferingClientHttpRequestFactory; | |
import org.springframework.http.client.SimpleClientHttpRequestFactory; | |
import org.springframework.web.client.RestTemplate; | |
import java.util.Collections; | |
@Configuration | |
@AllArgsConstructor | |
public class RestTemplateConfig { | |
@Bean | |
public RestTemplate restTemplate() { | |
var restTemplate = new RestTemplate(); | |
var factory = new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory()); | |
restTemplate.setInterceptors(Collections.singletonList(new RestTemplateInterceptor())); | |
restTemplate.setRequestFactory(factory); | |
return restTemplate; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment