feign-okhttp参数设置
时间: 2023-10-01 09:10:31 浏览: 201
要设置Feign使用OkHttp作为HTTP客户端,可以按照以下步骤进行操作:
1. 在配置文件中禁用默认的URLHttpConnection,启用OkHttp。可以使用以下配置:
feign.httpclient.enabled=false
feign.okhttp.enabled=true
2. 在pom.xml文件中添加Feign-OkHttp的依赖。可以使用以下配置:
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-okhttp</artifactId>
</dependency>
3. 可选步骤:根据需要配置OkHttp的参数。可以设置最大连接数和每个路由的最大连接数等参数。例如:
feign.okhttp.max-connections=200
feign.okhttp.max-connections-per-route=50
通过以上步骤,你可以成功设置Feign使用OkHttp作为HTTP客户端,并可以根据需要配置OkHttp的参数。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [Feign使用okhttp的排坑之旅](https://blog.csdn.net/ccf199201261/article/details/103547552)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *3* [SpringCloud Open feign 使用okhttp 优化](https://blog.csdn.net/sunlihuo/article/details/107359375)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文