feign连接池配置
时间: 2023-09-05 09:14:42 浏览: 78
要配置Feign连接池,你可以使用有连接池的底层实现来替换默认的URLConnection。首先,在消费者端的pom.xml文件中引入feign-httpclient依赖,例如:
```xml
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-httpclient</artifactId>
</dependency>
```
然后,在application.yml或application.properties文件中进行Feign连接池的配置,例如:
```yaml
feign:
client:
config:
default:
loggerLevel: BASIC # 设置日志级别为BASIC
httpclient:
enabled: true # 开启Feign对HttpClient的支持
max-connections: 100 # 设置连接池的最大连接数
max-connections-per-route: 50 # 设置每个路径的最大连接数
```
通过以上配置,你可以使用Feign连接池来提高Feign的性能。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [Feign的基本使用、日志配置和连接池配置详解](https://blog.csdn.net/qq_44749491/article/details/126531021)[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_2"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]