Spring Cloud替换Feign默认Client
使用HTTP Client替换Feign默认Client
依赖配置
<!-- Spring Cloud OpenFeign的Starter的依赖 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<!-- 使用Apache HttpClient替换Feign原生httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>com.netflix.feign</groupId>
<artifactId>feign-httpclient</artifactId>
<version>8.17.0</version>
</dependency>
核心配置
feign:
httpclient:
enabled: true
使用okhttp替换Feign默认Client
依赖配置
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Spring Cloud OpenFeign的Starter的依赖 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-okhttp</artifactId>
</dependency>
</dependencies>
核心配置
feign:
httpclient:
enabled: false
okhttp:
enabled: true
版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/03/26/replace-feign-default-client-with-spring-cloud/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。
THE END
0
二维码
打赏
海报
Spring Cloud替换Feign默认Client
使用HTTP Client替换Feign默认Client
依赖配置
<!-- Spring Cloud OpenFeign的Starter的依赖 -->
<dependency>
<groupId>org.springfra……
文章目录
关闭
共有 0 条评论