在做公司的微服务项目,其中一个服务有多文件上传功能,只要文件上传大小超过了1MB,就上传不了。
我的springboot版本是 2.0.5 , 按照文档配置了

spring:
  application:
    name: test
  servlet:
    multipart:
      enabled: true
      max-file-size: 5MB
      max-request-size: 50MB

结果还是不行,又折腾去启动类写Bean配置,也还不行。最终我想到微服务所有请求都会走zuul网关,在zuul网关也配置试试?
就成功了

spring:
  application:
    name: zuul
  servlet:
    multipart:
      enabled: true
      max-file-size: 5MB
      max-request-size: 50MB

这是微服务的一个小坑,希望能给别人带来参考。

Last modification:April 19, 2019
If you think my article is useful to you, please feel free to appreciate