[Java][Spring] Use the Jackson 3 JsonNullable module with useJackson3

Merged
SE
2mo ago
+40-0

With useSpringBoot4 and useJackson3 the application class still declares the JsonNullable bean as a Jackson 2 Module. When nothing else brings Jackson 2 in (documentationProvider=none, annotationLibrary=none) the generated project doesn't compile. With useJackson3 it's now a JacksonModule returning JsonNullableJackson3Module.

@cachescrubber @welshm @MelleD @atextor @manedev79 @javisst @borsch @banlevente @Zomzog @martin-mfg @KannaKim

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Fixes the generated Spring Boot application so the JsonNullable bean matches the configured Jackson version, preventing compilation failures when Jackson 3 is enabled and Jackson 2 is not on the classpath.

Bug Fixes

  • With useSpringBoot4 and useJackson3, the JsonNullable bean is now a JacksonModule returning JsonNullableJackson3Module instead of a Jackson 2 Module.
  • Projects without useJackson3 keep the Jackson 2 JsonNullableModule bean.