简体   繁体   English

如何限制 spring-boot-starter-web 中的完整有效负载大小?

[英]How to limit full payload size in spring-boot-starter-web?

I want to limit the full rest request size (including headers/body etc.).我想限制完整的 rest 请求大小(包括标题/正文等)。 Is their a way to do that via configuration or via code?他们是通过配置还是通过代码来做到这一点?
I've tried the follwoing but it doesn't work.我已经尝试了以下方法,但它不起作用。

spring.servlet.multipart.max-request-size=1MB
spring.servlet.multipart.enabled=true

Just use this config in src/main/resources/application.properties只需在 src/main/resources/application.properties 中使用此配置

spring.servlet.multipart.max-file-size=1024KB
spring.servlet.multipart.max-request-size=1024KB

You can check this on the default documentation https://spring.io/guides/gs/uploading-files/您可以查看默认文档https://spring.io/guides/gs/uploading-files/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用spring-boot-starter-web的Spring Boot无法在Maven中编译 - Spring Boot with spring-boot-starter-web fails to compile in maven 如何在不继承spring-boot-starter-web的情况下在Spring Boot中获取ObjectMapper实例? - How can I get an ObjectMapper instance in Spring Boot without inheriting from spring-boot-starter-web? 在没有 spring-boot-starter-web 的情况下配置 Spring Security AuthenticationManager - Configure Spring Security AuthenticationManager without spring-boot-starter-web @CrossOrigin 不适用于 spring-boot-starter-web 2.5.2 - @CrossOrigin not working for spring-boot-starter-web 2.5.2 结合 ObjectDB 使用 Spring-Boot-Starter-Web - Using Spring-Boot-Starter-Web in combination with ObjectDB spring-boot-starter-web @Autowired无效 - spring-boot-starter-web @Autowired isn't working 使用 spring-boot-starter-web “找不到可接受的表示” - "Could not find acceptable representation" using spring-boot-starter-web spring initializr:spring-boot-starter vs spring-boot-starter-web - spring initializr: spring-boot-starter vs spring-boot-starter-web spring-boot-starter-web和spring-boot-starter-web-services以及spring-boot-starter-jersey之间的区别 - Difference between spring-boot-starter-web and spring-boot-starter-web-services and spring-boot-starter-jersey spring-boot-starter-tomcat vs spring-boot-starter-web - spring-boot-starter-tomcat vs spring-boot-starter-web
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM