title: Content type 'multipart/form-data;boundary=----WebKitFormBoundary...' not supported Spring
body: <p>Spring 5.0.7: MVC, Data, Security. 
  I configure <code>multipartResolver</code>.</p>
  
  <p>I send next Ajax request:</p>
  
  <pre><code>$.ajax({
      type: 'POST',
      cache: false,
      processData: false,
      contentType: false,
      url: '/api/v1/category/add',
      data: new FormData(form)
  }).done(result=&gt;{console.log(result);}).fail(result=&gt;{
      console.error('ERROR:', result.responseJSON.httpStatus, result.responseJSON.message, result);
      self.toast.error('API Error.');
  });
  </code></pre>
  
  <p>But there is an error: <code>Content type 'multipart/form-data;boundary=----WebKitFormBoundary6xBCDjCtYYuUVR5c' not supported</code></p>
  
  <p>why? i don't understand why error happen.</p>
  
  <p>Controller:</p>
  
  <pre><code>@RestController
  @Secured("hasRole('ADMIN')")
  @RequestMapping(value = "/api/v1")
  public class ApiController {
  
      private static final Logger LOGGER = LogManager.getLogger(ApiController.class);
  
      @PostMapping(value = "/category/add", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
      private Response categoryAdd(Response response, @RequestBody CategoryAddForm categoryAddForm) {
          LOGGER.info(categoryAddForm.toString());
          return response;
      }
  
  }
  </code></pre>
  
  <p>CategoryAddForm:</p>
  
  <pre><code>public class CategoryAddForm {
  
      private String name;
  
      private String description;
  
      private MultipartFile preview;
  
      public CategoryAddForm() { }
  
      public CategoryAddForm(String name, String description, MultipartFile preview) {
          this.name = name;
          this.description = description;
          this.preview = preview;
      }
  
      public String getName() {
          return name;
      }
  
      public String getDescription() {
          return description;
      }
  
      public MultipartFile getPreview() {
          return preview;
      }
  }
  </code></pre>
  
  <p><em>I do not know what else to write, but SO requires more text. (</em></p>