Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How exactly spring.http.multipart.enabled is different from spring.servlet.multipart.enabled?

In Spring Boot, for multipart uploads, I see many of the tutorial sites suggests to have one of the below properties:

spring.http.multipart.enabled=false

or

spring.servlet.multipart.enabled=true

Can someone explain why these settings and their use cases? Especially if I set the property spring.http.multipart.enabled=false , then why spring.servlet.multipart.enabled=true

I tried searching through Stack Overflow, but did not find any relevant posts for this one.

like image 323
Rahul Raj Avatar asked Mar 21 '19 20:03

Rahul Raj


People also ask

What is spring servlet multipart Max request size?

spring. servlet. multipart. max-request-size is set to 128KB, meaning total request size for a multipart/form-data cannot exceed 128KB.

What is default value for spring servlet multipart Max file size?

The default is 10MB.

What is spring multipart file?

A representation of an uploaded file received in a multipart request. The file contents are either stored in memory or temporarily on disk. In either case, the user is responsible for copying file contents to a session-level or persistent store as and if desired.


1 Answers

spring.http.multipart.enabled has been replaced with spring.servlet.multipart.enabled

If you're using Spring Boot 2.0.0 or later you should use spring.servlet.multipart.enabled

See also:

  • additional-spring-configuration-metadata.json
  • Spring Boot Reference of 1.5.19.RELEASE version (the Common application properties section lists spring.http.multipart.enabled).
  • Spring Boot reference of 2.0.0.RELEASE version (replaced with spring.servlet.multipart.enabled)
  • Upgrading from an Earlier Version of Spring Boot
  • MultipartProperties (1.5.19.RELEASE)
  • MultipartProperties (2.0.0.RELEASE)
like image 59
Denis Zavedeev Avatar answered Sep 24 '22 19:09

Denis Zavedeev