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
posted @ 2020-05-19 10:15  crazy-zz5536  阅读(7141)  评论(0编辑  收藏  举报