title: Multipart File Upload:Size exceed exception in spring boot return JSON error message
body: <p>As I have set maximum file upload limit,I am getting </p>
  
  <pre><code>org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: The field file exceeds its maximum permitted size of 2097152 bytes 
  </code></pre>
  
  <p>error while uploading file.It is giving 500 error to my api,I should I handle this error and return response in <code>JSON</code> format not an errorpage as provided in <code>ErrorController</code></p>
  
  <p>I want to catch that exception and give JSON response not <code>ErrorPage</code>.</p>
  
  <pre><code>@RequestMapping(value="/save",method=RequestMethod.POST)
      public ResponseDTO&lt;String&gt; save(@ModelAttribute @Valid FileUploadSingleDTO fileUploadSingleDTO,BindingResult bindingResult)throws MaxUploadSizeExceededException
      {
          ResponseDTO&lt;String&gt; result=documentDetailsService.saveDocumentSyn(fileUploadSingleDTO, bindingResult);
  
          return result;
  
      }
  </code></pre>
  
  <p>DTO that accepts document as follows</p>
  
  <pre><code>public class FileUploadSingleDTO {
  @NotNull
      private Integer documentName;
  
      private Integer documentVersion;
  
      @NotNull
      private MultipartFile file;
  }
  </code></pre>