时间:2024-6-24 作者:老大夫 分类: SpringCloud
ApaCheHTTP5代替默认浏览器HTTPURLConection,性能会提升。
<!-- httpclient5-->
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.3</version>
</dependency>
<!-- feign-hc5-->
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-hc5</artifactId>
<version>13.1</version>
</dependency>
server:
port: 80
spring:
application:
name: cloud-consumer-openfeign-order
####Spring Cloud Consul for Service Discovery
cloud:
consul:
host: localhost
port: 8500
discovery:
prefer-ip-address: true #优先使用服务ip进行注册
service-name: ${spring.application.name}
openfeign:
client:
config:
default:
connectTimeout: 4000 #连接超时时间
readTimeout: 4000 #读取超时时间
httpclient:
hc5:
enabled: true
#cloud-payment-service:
#connectTimeout: 4000 #连接超时时间
#readTimeout: 4000 #读取超时时间
推荐阅读:
OpenFeign重试机制
OpenFeign日志打印功能
OpenFeign请求压缩功能
Resilience4J的CircuitBreaker断路器之熔断
gateway 报错:Unable to find RoutePredicateFactory with name My
Resilience4J的BulkHead舱壁隔离
OpenFeign超时控制功能
四种限流算法
报错:I/O error on POST request for "http://localhost:9411/api/v2/spans": Connect to http://localhost:9411 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: no further information
SpringCloud之OpenFeign负载均衡工具
行动消除疑虑