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;
这个设置是大小不限制,主要是这个设置。
总结:
- 我们在 使用springboot出现大小限制时,可以选择修改该默认大小限制
- 更换springboot默认tomcat容器为其他容器,如undertow
作者:努力为明天
-------------------------------------------
个性签名:独学而无友,则孤陋而寡闻。做一个灵魂有趣的人!
如果觉得这篇文章对你有小小的帮助的话,记得在右下角点个“推荐”哦,博主在此感谢!