本文主要是介绍Feign远程调用数据量大时压缩导致转json失败,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Spring Cloud Feign 支持对请求和响应进行GZIP压缩,以提高通信效率。
fegin默认的Client对响应流不支持对gzip后的字节流进行解析,所以在序列化成对象时会存在解析问题。我们可以使用过滤器实现。开始实现。
1.依赖引入,pom文件添加feign-httpclient,将feign的http组件改为OkHttp
<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-openfeign</artifactId><version>2.2.0.RELEASE</version>
</dependency>
<dependency><groupId>io.github.openfeign</groupId><artifactId>feign-okhttp</artifactId><version>10.7.4</version>
</dependency>
2.在appl
这篇关于Feign远程调用数据量大时压缩导致转json失败的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!