title: Spring Boot HttpMessageNotReadableException
body: <p>I have this class to represent a User:</p>
  
  <pre><code>@JsonInclude(JsonInclude.Include.NON_NULL)
  @JsonIgnoreProperties(ignoreUnknown = true)
  @Getter
  @Setter
  public class UserDto implements Serializable {
      private Long id;
      private String username;
      private String email;
      private String password;
      private Collection&lt;? extends GrantedAuthority&gt; roles;
  
      public UserDto() {
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>What I'm trying to do is to let Spring map @RequestBody of the controller below to a UserDto:</p>
  
  <pre><code>public class AuthController {
      @Autowired
      private UserService userService;
      @Autowired
      private AuthService authService;
  
      @RequestMapping(value = "signup", method = RequestMethod.POST)
      public ResponseEntity&lt;?&gt; addUser(@RequestBody UserDto userDto) throws Exception {
          UserDto existingUserDto;
  
          try {
              existingUserDto = userService.save(userDto);
          } catch (Exception e) {
              return new ResponseEntity&lt;&gt;(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
          }
          return new ResponseEntity&lt;&gt;(existingUserDto, HttpStatus.CREATED);
      }
  }
  </code></pre>
  
  <p>But instead what when I try to send a Post request I get the following error from Spring:</p>
  
  <pre><code>Failed to read HTTP message:                 org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Unrecognized token 'username': was expecting ('true', 'false' or 'null')
   at [Source: java.io.PushbackInputStream@2c477da6; line: 1, column: 10]; nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'username': was expecting ('true', 'false' or 'null')
   at [Source: java.io.PushbackInputStream@2c477da6; line: 1, column: 10]
  </code></pre>
  
  <p>What I tried to do was declaring a custom MappingJackson2HttpMessageConverter but I didn't get any different result</p>
  
  <pre><code>@Bean
      public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() {
          MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
          ObjectMapper objectMapper = new ObjectMapper();
          objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
          jsonConverter.setObjectMapper(objectMapper);
          return jsonConverter;
      } 
  </code></pre>
  
  <p>Here a screen of the requested I'm doing ( with Content-Type: application/json):</p>
  
  <p><a href="https://i.stack.imgur.com/GqwVw.png" rel="nofollow noreferrer">PostMan Request</a></p>
  
  <p>Do you have any idea?</p>