title: Read HttpServletRequest object from Spring Boot controller method
body: <p>Below is my controller method definition</p>
  
  <pre><code>@Autowired
  private HttpServletRequest request;
  
  @PostMapping(path = "/abc")
  public String createAbc(@RequestBody HttpServletRequest request)
          throws IOException {
  
      logger.info("Request body: "+request.getInputStream());
  
      return "abc";
  
  }
  </code></pre>
  
  <p>All i want to do is print contents to request body.
  But when i make a POST request i see below error: </p>
  
  <blockquote>
    <p>Type definition error: [simple type, class
    javax.servlet.http.HttpServletRequest]; nested exception is
    com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot
    construct instance of <code>javax.servlet.http.HttpServletRequest</code> (no
    Creators, like default construct, exist): abstract types either need
    to be mapped to concrete types, have custom deserializer, or contain
    additional type information\n at [Source: (PushbackInputStream); line:
    1, column: 2]",</p>
  </blockquote>
  
  <p>I'm using Spring boot 2.x version.Any idea what's wrong in my code?</p>