Jackson fails to deserialize 1 field POJO #3085
Labels
lombok
Issue (likely) related to use of Lombok
to-evaluate
Issue that has been received but not yet evaluated
Describe the bug
When trying to deserialize JSON to POJO it fails when POJO has only one field.
Version information
2.11.4
To Reproduce
POJO:
@AllArgsConstructor //lombok, if i add constructor manually it still fails
public class SubjectRequest {
public final String name;
}
While trying to create this POJO via spring's @requestbody it fails. When i add another parameter, ex public final String a;
jackson works correctly. (creates POJO with {name: 'text', a: null})
Expected behavior
Jackson should be able to deserialize 1 field POJO
Error message
Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot construct instance of
ad.school.planner.inner.subject.SubjectRequest
(although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance ofad.school.planner.inner.subject.SubjectRequest
(although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)at [Source: (PushbackInputStream); line: 2, column: 5]]
The text was updated successfully, but these errors were encountered: