OpenFeign替换为OkHttp
pom中引入feign-okhttp<dependency><groupId>io.github.openfeign</groupId><artifactId>feign-okhttp</artifactId></dependency>在application.yml中配置okhttpfeign:httpclient:conn
·
pom中引入feign-okhttp
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-okhttp</artifactId>
</dependency>
在application.yml中配置okhttp
feign:
httpclient:
connection-timeout: 2000 #单位ms,默认2000
max-connections: 200 #线程池最大连接数
okhttp:
enabled: true
经过上面设置已经可以使用okhttp了,因为在FeignAutoConfiguration中已实现自动装配
如果需要对okhttp做更精细的参数设置,那需要自定义okhttp的实现,可以模仿上图中的实现
更多推荐
已为社区贡献1条内容
所有评论(0)