title: Spring sets @PostMapping fields from GET url query?
body: <p>My setup is as follows:
  I have a form and a table on the same page: <code>localhost:8080/persons?firstname=frank</code></p>
  <p>This shows all persons with firstname accordingly.
  From the same page, it is possible to submit a form for creating new persons:</p>
  <pre><code>&lt;form action=&quot;/persons&quot; method=&quot;POST&quot;&gt;
      &lt;input type=&quot;hidden&quot; name=&quot;_method&quot; value=&quot;POST&quot;/&gt;
      &lt;input type=&quot;text&quot; name=&quot;firstname&quot;/&gt;
      &lt;input type=&quot;text&quot; name=&quot;lastname&quot;/&gt;
      &lt;input type=&quot;submit&quot; value=&quot;Create&quot;/&gt;
  &lt;/form&gt;
  </code></pre>
  <p>Problem: when I actually <code>POST</code> the form content to the <code>Spring</code> <code>@Controller</code>, the following content gets send:</p>
  <p>URL: <code>/persons?firstname=frank</code></p>
  <p>Request Body: <code>_method=post&amp;firstname=&amp;lastname=doe</code></p>
  <p>Spring then magically merges GET-query params and POST form params into one DTO, and results in a <code>PersonDto</code> that has both firstname + lastname set</p>
  <pre><code>@PostMapping(&quot;/persons&quot;)
  public void addPerson(PersonDto p) {
      //p.firstname =&gt; Frank, p.lastname = Doe
  }
  
  PersonDto {
      public String firstname, lastname, age;
  }
  </code></pre>
  <p>Somehow <code>Spring</code> derives the request body values <em>also</em> from the get-query url parameters. Why??</p>