title: How can I receive multipart/form-data in Spring MVC Controller?
body: <p>I need to implement a REST-Endpoint, that receives multipart/form-data<br>
  I use: <br></p>
  
  <ul>
  <li>Spring Boot <br></li>
  <li>Kotlin<br></li>
  <li>Spring MVC<br></li>
  </ul>
  
  <p>A multipart form submit with the following parts:</p>
  
  <p>deployment-name ----- text/plain <br>
  enable-duplicate-filtering ----- text/plain <br>
  deploy-changed-only ----- text/plain <br>
  deployment-source ----- text/plain <br>
  tenant-id ----- text/plain <br>
  * ----- application/octet-stream <br></p>
  
  <p>The Rest Controller looks so:</p>
  
  <pre><code>    @PostMapping("/data/deployment/create")
      fun uploadDmn(
              @RequestParam("deployment-name")
              deploymentName: String,
              @RequestParam("enable-duplicate-filtering")
              enableDuplicateFiltering: String?,
              @RequestParam("deploy-changed-only")
              deployChangedOnly: String,
              @RequestParam("deployment-source")
              deploymentSource: String,
              @RequestParam("tenant-id")
              tenantId: String,
              @RequestParam("data")
              data: MultipartFile
      ) {
          println(deploymentName)
          println(deployChangedOnly)
          println(deploymentSource)
          println(tenantId)
          println(data.toString())
      }
  </code></pre>
  
  <p>For all params that works, but for the last one that doesn't work.
  I've tried to give a name "data", "*", "file" that doesn't work.</p>
  
  <blockquote>
    <p>Required request part 'data' is not present<br></p>
  </blockquote>
  
  <p>The Controller doesn't see that file. <br></p>
  
  <p>I've tried too to use Retrofit:</p>
  
  <pre><code>    @PostMapping("/data/deployment/create")
      @Multipart
      fun uploadDmn(
              @Part("data")
              data: MultipartFile
      ) {
          println(data.toString())
  }
  </code></pre>
  
  <p>But that doesn't work too:</p>
  
  <blockquote>
    <p>Parameter specified as non-null is null <br></p>
  </blockquote>
  
  <p>How can I work with that content type? multipart/form-data</p>
  
  <p>Example of Request:</p>
  
  <pre><code>--28319d96a8c54b529aa9159ad75edef9
  Content-Disposition: form-data; name="deployment-name"
  
  aName
  --28319d96a8c54b529aa9159ad75edef9
  Content-Disposition: form-data; name="enable-duplicate-filtering"
  
  true
  --28319d96a8c54b529aa9159ad75edef9
  Content-Disposition: form-data; name="deployment-source"
  
  process application
  --28319d96a8c54b529aa9159ad75edef9
  Content-Disposition: form-data; name="data"; filename="test.bpmn"
  
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;bpmn2:definitions ...&gt;
    &lt;!-- BPMN 2.0 XML omitted --&gt;
  &lt;/bpmn2:definitions&gt;
  --28319d96a8c54b529aa9159ad75edef9--
  </code></pre>
  
  <p>Can anyone help please?</p>