FeignClient服务之间调用,数据传输超过10M


问题描述:在 springboot 项目中,使用feignclient在服务之间传输数据,若大小超过10M,控制台或者日志中会提示你类似下面这样的信息:

Could not read document: UT000020 : Connection terminated as request was larger than 10485769; 

nested exception is java.io.Exception:UT000020 : Connection terminated as request was larger than 10485769;

项目 springboot 版本 1.5.2

解决方案:application.properties里添加如下配置

spring.http.multipart.max-file-size=-1
spring.http.multipart.max-request-size=-1

默认值

private String maxFileSize= "1MB";
private String maxRequestSize = "10MB";

以及下面这个配置:

server.tomcat.max-http-post-size=-1;

这个设置是大小不限制,主要是这个设置。

总结

  1. 我们在 使用springboot出现大小限制时,可以选择修改该默认大小限制
  2. 更换springboot默认tomcat容器为其他容器,如undertow


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM