java-time: java.time on Jackson 3 vs 2, @JsonFormat, time zones, Spring Boot 4.2 spring.jackson.*

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b4HkWoC7hLzk61vZa8
This commit is contained in:
2026-12-03 23:41:03 +05:30
co-authored by Claude Sonnet 5.5
parent f5ed5d1605
commit 26f64bc184
42 changed files with 1505 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
== old Jackson 2 payload, read by Jackson 3 defaults
{"meeting":{"day":[2026,12,15],"wallClock":[2026,12,15,10,30],"createdAt":1797310800.000000000,"startsAt":1797310800.000000000,"reminderAt":1797310800.000000000},"length":5400.000000000,"month":"DECEMBER"}
OK Job[meeting=Meeting[day=2026-12-15, wallClock=2026-12-15T10:30, createdAt=2026-12-15T05:00:00Z, startsAt=2026-12-15T05:00Z, reminderAt=2026-12-15T05:00Z], length=PT1H30M, month=DECEMBER]
== new Jackson 3 payload, read by a Jackson 2 consumer (defaults + module)
{"meeting":{"day":"2026-12-15","wallClock":"2026-12-15T10:30:00","createdAt":"2026-12-15T05:00:00Z","startsAt":"2026-12-15T10:30:00+05:30","reminderAt":"2026-12-15T10:30:00+05:30"},"length":"PT1H30M","month":12}
FAIL InvalidFormatException: Cannot deserialize value of type `java.time.Month` from number 12: index value outside legal index range [0..11]
== Jackson 3 told to keep writing the Jackson 2 shapes
{"meeting":{"day":[2026,12,15],"wallClock":[2026,12,15,10,30],"createdAt":1797310800.000000000,"startsAt":1797310800.000000000,"reminderAt":1797310800.000000000},"length":5400.000000000,"month":12}
identical to the Jackson 2 payload : false
FAIL InvalidFormatException: Cannot deserialize value of type `java.time.Month` from number 12: index value outside legal index range [0..11]