Increase HTTP Post maxPostSize in Spring Boot

后端 未结 14 2184
无人共我
无人共我 2020-11-28 06:48

I\'ve got a fairly simple Spring Boot web application, I have a single HTML page with a form with enctype=\"multipart/form-data\". I\'m getting this error:

14条回答
  •  清酒与你
    2020-11-28 07:34

    First, make sure you are using spring.servlet instead of spring.http.

    ---
    spring:
      servlet:
        multipart:
          max-file-size: 10MB
          max-request-size: 10MB
    

    If you have to use tomcat, you might end up creating EmbeddedServletContainerCustomizer, which is not really nice thing to do.

    If you can live without tomat, you could replace tomcat with e.g. undertow and avoid this issue at all.

提交回复
热议问题