Define Multipart File Upload Size Limit in Spring Boot Application

Uploading files in a Spring Boot application is a common requirement, but there might be scenarios where we need to increase the default file upload size limits. In this step-by-step guide, we’ll learn how to define multipart file upload size limit in a Spring Boot application.


Before we get started, make sure you have the following in place:

  1. A Spring Boot project set up.
  2. Basic knowledge of Spring Boot and application properties.

Step 1: Open Application Configuration

Open your Spring Boot project’s or application.yml file. If you don’t already have one, create it in your project’s resources directory.

Step 2: Configure File Upload Size Limits

To adjust the file upload size limits, you need to add or modify specific properties in your application configuration.

For, add the following lines:


For application.yml, add the following YAML configuration:

      max-file-size: 10MB
      max-request-size: 10MB

In these configurations, we set the maximum file size (max-file-size) and the maximum request size (max-request-size) to 10 megabytes (MB). You can adjust these values according to your requirements.

Step 3: Save Configuration

Save the changes to your application configuration file.

Step 4: Restart Your Spring Boot Application

After updating the configuration, you need to restart your Spring Boot application for the changes to take effect.

Step 5: Test the Increased Upload Size

Now that you’ve increased the multipart file upload size, you can test it by trying to upload larger files in your application. It should now allow file uploads up to the specified limits.


Increasing the multipart file upload size in a Spring Boot application is straightforward. By modifying the application configuration, you can customize the file size limits to suit your needs. Just remember to test your application thoroughly after making these changes and ensure it aligns with your security requirements.

Notify of
Inline Feedbacks
View all comments