SpringBoot,限制 PUT 请求的请求大小

acc*_*tur 6 tomcat spring-boot spring-restcontroller

我正在运行带有嵌入式 tomcat 容器的 spring-boot 服务。

有没有办法通过通用应用程序属性或 EmbeddedServletContainerFactory来限制 HTTP PUT请求的大小?谢谢

Tan*_*kar 1

将此属性添加到您的 application.properties 文件中。

spring.http.multipart.max-request-size=10MB
Run Code Online (Sandbox Code Playgroud)

请参阅以下内容了解更多信息:

https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html