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