指南

maven

<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-okhttp</artifactId>
</dependency>

配置文件

feign.httpclient.enabled=false
feign.okhttp.enabled=true

配置

@Configuration
@ConditionalOnClass(Feign.class)
@AutoConfigureBefore(FeignAutoConfiguration.class)
public class FeignOkHttpConfig { @Autowired
OkHttpLoggingInterceptor okHttpLoggingInterceptor; @Bean
public okhttp3.OkHttpClient okHttpClient(){
return new okhttp3.OkHttpClient.Builder()
.readTimeout(60, TimeUnit.SECONDS)
.connectTimeout(60, TimeUnit.SECONDS)
.writeTimeout(120, TimeUnit.SECONDS)
.connectionPool(new ConnectionPool())
// .addInterceptor();
.build();
}
}

实践

不需要额外编写FeignOkHttpConfig,feign本身已经存在FeignOkHttpAutoConfiguration了,不需要额外配置。

最新文章

  1. Silverlight动态生成控件实例
  2. TCP/IP 端口号大全
  3. 11.Android之常用对话框AlertDialog学习
  4. MySQL中varchar类型在5.0.3后的变化
  5. 在 OS X Yosemite 中部署Mesos
  6. html移动端开发注意事项
  7. (转)20 个大大节省你时间的 HTML5 开发工具
  8. Bower+grunt-wiredep自动注入包到html
  9. TCP TIME WAIT
  10. 运维面试题之linux基础
  11. org.hibernate.AssertionFailure: null id in xxx entry (don&#39;t flush the Session after an exception occurs)
  12. JavaScript实现input输入框限制输入值的功能
  13. PHP中get请求中参数的key不能是para
  14. ElasticSearch集群介绍二
  15. C++中类的前向声明
  16. Django本地开发,引用静态文件,火狐浏览器不能访问静态文件,谷歌浏览器却能访问静态文件
  17. python selenium爬取QQ空间方法
  18. mtime参数的理解
  19. Qt计算器开发(三):执行效果及项目总结
  20. 基于Linux的Samba开源共享解决方案测试(三)

热门文章

  1. Codeforces 1092 F Tree with Maximum Cost (换根 + dfs)
  2. 搭建python运行环境
  3. Kafka系列3:深入理解Kafka消费者
  4. 事务特性ACID及隔离级别
  5. JMeter之If Controller深究二
  6. Python趣味入门02: 妥妥地安装配置Python(Windows版)
  7. Kali桥接模式下配置ip
  8. Visual C# 2015调用SnmpSharpNet库实现简单的SNMP元素查询
  9. 大数四则运算之减法运算-----c语言版
  10. #614 C. NEKO&#39;s Maze Game[简易DFS,0|1转换]