title: Why @ModelAttribute does not work like @RequestBody?
body: <p>My goal is to set a POJO attribute with <code>form-data</code>. I have a generic POJO, and when I use <code>JSON</code> it works as expected, so I am not sure <code>form-data</code> behave differently.</p>
  <p>e.g</p>
  <p>The POJO</p>
  <pre><code>public class Account_Info {
    @JsonProperty(&quot;name&quot;)
    private String firstName;
  
    public String getFirstName() {
      return firstName;
    }
  }
  </code></pre>
  <p>I wish to send a form data with &quot;name&quot; as key.</p>
  <pre><code>let formData = new FormData();
  
  formData.append(&quot;name&quot;, &quot;a&quot;);
  </code></pre>
  <p>My expected result is: The POJO's attribute of <code>firstName</code> will have a value of <code>a</code>.</p>
  <p>My actual result is: The POJO's attribute of <code>firstName</code> is null.</p>
  <p>What I did:</p>
  <ol>
  <li>I created a Account_InfoDto.</li>
  </ol>
  <pre><code>public class Account_InfoDto {
    @JsonProperty(&quot;name&quot;)
    private String firstName;
  
    public String getFirstName() {
      return firstName;
    }
  }
  </code></pre>
  <ol start="2">
  <li>I created a controller</li>
  </ol>
  <p><strong>with <code>@RequestBody</code></strong></p>
  <pre><code>  @PostMapping(value = &quot;/account_info&quot;)
    public Account_InfoDto postAccount_Info(@RequestBody Account_InfoDto account_info) {
      return account_info;
    }
  </code></pre>
  <p><strong>with <code>@ModelAttribute</code></strong></p>
  <pre><code>  @PostMapping(value = &quot;/account_info&quot;, consumes = &quot;multipart/form-data&quot;)
    public Account_InfoDto postAccount_Info(@ModelAttribute Account_InfoDto account_info) {
      return account_info;
    }
  </code></pre>
  <ol start="3">
  <li>Send a request to POST /account_info</li>
  </ol>
  <p>with <code>JSON</code></p>
  <pre><code>{
    &quot;name&quot;: &quot;a&quot;
  }
  </code></pre>
  <p>The actual response is:</p>
  <pre><code>{
    &quot;name&quot;: &quot;a&quot;
  }
  </code></pre>
  <p><strong>with <code>form-data</code></strong></p>
  <pre><code>let formData = new FormData();
  
  formData.append(&quot;name&quot;, &quot;a&quot;);
  </code></pre>
  <p>The actual result is:</p>
  <pre><code>{
    &quot;name&quot;: null
  }
  </code></pre>