Added property spring.jackson.deserialization.fail-on-unknown-properties=true
Which throws
UnrecognizedPropertyException
tried to capture this excetion via below code
@ExceptionHandler(UnrecognizedPropertyException.class)
public ResponseEntity<Map<String, List>> handleUnrecognizedPropertyException(UnrecognizedPropertyException ex) {
List errors = Collections.singletonList(ex.getMessage());
return new ResponseEntity<>(getErrorsMap(errors), new HttpHeaders(), HttpStatus.NOT_FOUND);
}