title: Mapping all request params into an object in Spring Controller
body: <p>So, url requested looks like </p>
  
  <pre><code>localhost:8080/contacts?id=22&amp;name=John&amp;eventId=11
  </code></pre>
  
  <p>and also I got an object to map request into </p>
  
  <pre><code>public class ContactDTO {
      private Long id;
      private String name;
      private Long eventId;
  }
  </code></pre>
  
  <p>I use a controller method like passing my request params into an object </p>
  
  <pre><code>@GetMapping("/contacts")
  public ContactDTO contacts(ContactDTO contact) {
      // everything is awesome! contact maps clearly
      return contact;
  }
  </code></pre>
  
  <p>The question is how to map like this but have different name </p>
  
  <pre><code>    localhost:8080/contacts?id=22&amp;name=John&amp;event_id=11
  </code></pre>
  
  <p>Setting @JsonAttribute doesn't works because Jackson mapper works only in requestbody. 
  Maybe I should write custom HandlerMethodArgumentResolver or something like that?</p>
  
  <p>P.S.
  I've got a dirty hack (objectMapper is injected, so I can use @JsonAttributes),
  But this case fails on array mapping, same mapping with requestbody works fine</p>
  
  <pre><code>@GetMapping("/contacts")
  public ContactsDTO contacts(@RequestParam Map&lt;String,String&gt; params) {
      ContactDTO contactDTO = objectMapper.convertValue(params,ContactDTO.class);
      return contactDTO;
  }
  </code></pre>