JsonMappingException: Can not deserialize instance of java.lang.Integer out of START_OBJECT token
<p>I wanted to write a small and simple REST service using Spring Boot.
Here is the REST service code:</p>

<pre><code>@Async
@RequestMapping(value = "/getuser", method = POST, consumes = "application/json", produces = "application/json")
public @ResponseBody Record getRecord(@RequestBody Integer userId) {
    Record result = null;
    // Omitted logic

    return result;
}
</code></pre>

<p>The JSON object I sent is the following:</p>

<pre><code>{
    "userId": 3
}
</code></pre>

<p>And here is the exception I got: </p>

<blockquote>
  <p>WARN 964 --- [  XNIO-2 task-7]
  .w.s.m.s.DefaultHandlerExceptionResolver : Failed to read HTTP
  message:
  org.springframework.http.converter.HttpMessageNotReadableException:
  Could not read document: Can not deserialize instance of
  java.lang.Integer out of START_OBJECT token at [Source:
  java.io.PushbackInputStream@12e7333c; line: 1, column: 1]; nested
  exception is com.fasterxml.jackson.databind.JsonMappingException: Can
  not deserialize instance of java.lang.Integer out of START_OBJECT
  token at [Source: java.io.PushbackInputStream@12e7333c; line: 1,
  column: 1]</p>
</blockquote>