com.itxiaoer.commons.request.RequestConfig Maven / Gradle / Ivy
package com.itxiaoer.commons.request;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
import java.util.Collections;
/**
* @author : liuyk
*/
@Configuration
public class RequestConfig {
@Bean
public RestTemplate restTemplate() {
RestTemplate restTemplate = new RestTemplate();
restTemplate.setInterceptors(Collections.singletonList(tokenInterceptor()));
return restTemplate;
}
@Bean
public TokenInterceptor tokenInterceptor() {
return new TokenInterceptor();
}
}