feign-连接池

feign-连接池

起男 982 2021-10-02

feign-连接池

  1. 导入依赖(需要依靠第三方实现)

    		<!-- httpclient -->
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
                <version>4.5.13</version>
            </dependency>
    
            <!-- feign httpclient 整合-->
            <dependency>
                <groupId>io.github.openfeign</groupId>
                <artifactId>feign-httpclient</artifactId>
                <version>11.6</version>
            </dependency>
    
  2. 修改配置文件

    feign:
      httpclient:
        enabled: true #启用httpclient连接池
        max-connections: 200 #最大连接数量
        max-connections-per-route: 50 #单个路径最大连接的数量
        connection-timeout: 2000 #超时等待