springcloud-eureka集群-整合feign框架自定义拦截器

@Configuration
public class BaseConfig {

    @Bean
    public RequestInterceptor getRequestInterceptor(){
        return new RequestInterceptor() {
            @Override
            public void apply(RequestTemplate requestTemplate) {
                /** 设置请求头信息 **/
                requestTemplate.header("Content-Type", "application/json");
                System.out.println("自定义拦截器");
            }
        };
    }

}

猜你喜欢

转载自blog.csdn.net/Keith003/article/details/82218845