JSON parse error: Cannot construct instance of `com.**` (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 of `com.**` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)
at [Source: (PushbackInputStream); line: 2, column: 2]]
spring boot 的post傳遞實體類的過程中出現了反向序列化的異常
解決方案
在實體類中添加無參構造函數。
原因
jackson的反序列化需要無參構造函數,而我在實體類中添加了有參數的構造函數。
在實體類中添加無參構造函數即可。