搭建好简单版本的feign客户端与服务端,本文基于简单版本进行扩展,修改默认的Http客户端为okHttp 或 HttpClient。
修改为HttpClient
1.添加maven依赖
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-httpclient</artifactId>
<version>10.10.0</version>
</dependency>
2.修改配置文件
feign:
client:
config:
default:
connectTimeout: 5000
readTimeout: 5000
loggerLevel: basic
hystrix:
enabled: true
httpclient:
enabled: true
修改为OkHttp
修改配置文件即可
feign:
client:
config:
default:
connectTimeout: 5000
readTimeout: 5000
loggerLevel: basic
hystrix:
enabled: true
okhttp:
enabled: true