Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4HkWoC7hLzk61vZa8
2.7 KiB
2.7 KiB
java-time: java.time on Jackson 3 (and what changed from Jackson 2)
Companion code for JavaTimeModule in Jackson 3: java.time Support Built In, Date Formats, Time Zones and Migration.
Verified with JDK Temurin 25.0.5.1, Maven 3.9.11, Jackson 3.3.0 and 2.23.0
(jackson-datatype-jsr310 2.23.0). The Spring Boot part uses Boot 4.2.0, which manages Jackson 3.1.8.
Run
./scripts/run-all.sh # plain Jackson programs T01..T11 and the two compile errors
./scripts/run-versions.sh # T11 on Jackson 3.1.8, 3.2.4 and 3.3.0
./scripts/run-boot.sh # the Spring Boot app in boot/, one start per configuration
Set MVN_ARGS to pass extra Maven options. The scripts run the JVM with -Duser.timezone=UTC;
T05TimeZones changes the zone itself.
Files
| Program | Shows | Output |
|---|---|---|
| T01NoModuleNeeded | Jackson 2 needs a module, Jackson 3 does not | 01 |
| T02OutputDiff | Four mappers, twenty values | 02 |
| T03FeatureDefaults | Every DateTimeFeature default |
03 |
| T04ReadingOffsets | Offsets and zone ids on the way in | 04 |
| T05TimeZones | JVM zone vs mapper zone | 05 |
| T06JsonFormat | @JsonFormat per field |
06 |
| T07FormatTraps | Lenient dates, YYYY, quoted Z |
07 |
| T08EpochNumbers | Seconds vs milliseconds | 08 |
| T09GlobalFormats | Mapper-wide formats | 09 |
| T10StoredPayloads | Reading across the two majors | 10 |
| T11MonthTrap | Month as a number |
11, 12 |
| boot/ | spring.jackson.* on Boot 4.2.0 |
13 |
| src/broken/ | Two Jackson 2 habits that no longer compile | 00 |