Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

upload file size limit in spring boot

In version 2.1.0, spring.servlet.multipart.max-file-size property failed to bind org.springframework.util.unit.DataSize.

Property : spring.servlet.multipart.maxFileSize= 50Mb

Exception

Description:

Failed to bind properties under 'spring.servlet.multipart.max-file-size' to org.springframework.util.unit.DataSize:

Property: spring.servlet.multipart.maxfilesize
Value: 50Mb
Origin: "spring.servlet.multipart.maxFileSize" from property source "bootstrapProperties"
Reason: failed to convert java.lang.String to @org.springframework.boot.convert.DataSizeUnit org.springframework.util.unit.DataSize

Action:

Update your application's configuration
like image 221
Thirumal Avatar asked Nov 07 '18 11:11

Thirumal


1 Answers

As Michael & Stahorszki mentioned

"B"

must be capital

Property : spring.servlet.multipart.maxFileSize= 50MB

In Yaml

spring:    
  servlet:
    multipart:
      max-file-size: ${MAX_FILE_SIZE:8MB}
      max-request-size: ${MAX_REQUEST_SIZE:8MB}
like image 100
Thirumal Avatar answered Oct 21 '22 17:10

Thirumal