title: Spring MVC Map Request Body to Primitive Type
body: <p>I want to handle simple POST request by spring mvc. The request body contain only a single int value. Can anyone help me to write the action method. My code is below:</p>
  
  <pre><code>@PostMapping(value = "/update")
  @ResponseBody
  public ResponseEntity updateLogLevel(@RequestBody int level) {
      try {
          //process request
      } catch (Exception ex) {
          return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
      }
      return ResponseEntity.ok(Constant.STATUS_SUCCESS);
  }
  </code></pre>
  
  <p>But this code throw exception: </p>
  
  <pre><code>org.springframework.http.converter.HttpMessageNotReadableException",
  "message":"JSON parse error: Can not deserialize instance of int out of START_OBJECT token; 
  nested exception is 
  com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of int out of START_OBJECT token
  </code></pre>
  
  <p>My request body:</p>
  
  <pre><code>{
      "level" : 100
  }
  </code></pre>