title: how to properly handle request parameters in a Spring Data REST controller?
body: <p>in my Spring Data REST app, I have the following controller:</p>
  
  <pre><code> @RestController
      @RequestMapping("/people")
      public class PersonController {
          @RequestMapping(value = "/**", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
          public ResponseEntity&lt;String&gt; savePerson(@RequestBody Person person, UriComponentsBuilder b, @RequestParam Map&lt;String, ?&gt; id) {
  
  
              UriComponents uriComponents = 
                      b.path("/people/{id}").buildAndExpand(id);
              HttpHeaders responseHeaders = new HttpHeaders();
                 responseHeaders.setLocation(uriComponents.toUri());
                 responseHeaders.set("MyResponseHeader", "MyValue");
              return new ResponseEntity&lt;String&gt;("Hello World\n\n", responseHeaders, HttpStatus.CREATED);
          }
      }
  </code></pre>
  
  <p>When I make the following post:</p>
  
  <pre><code>curl -i -X POST -H "Content-Type:application/json" -d '{  "firstName" : "Frodo",  "lastName" : "Baggins" }' http://localhost:8080/people
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>{"timestamp":1476418616900,"status":500,"error":"Internal Server Error","exception":"java.lang.IllegalArgumentException","message":"Map has no value for 'id'","path":"/people"}
  </code></pre>
  
  <p>What should I change to fix this error?</p>