Closed penweizgx closed 2 weeks ago
Is LocalDate
declared as final
? You are using:
ObjectMapper.DefaultTyping.NON_FINAL
so type id would not be included for final
classes.
Note: another, safer way to force use of type id is to apply @JsonTypeInfo
on wrapper Bean like:
public class DateValueWrapper {
@JsonTypeInfo(....)
public Object data;
// and getters, setters, if you want
}
because in that case Type Id inclusion will be forced for date
field.
Not a bug (although Default Typing usage itself can be confusing -- also, not specific to LocalDate
per se). Closing.
Why does the LocalDate type object not record its type after serialization, resulting in the principle type cannot be restored after deserialization, while the date type can。