Skip to content

Restore JsonLineMapper compatibility with Jackson 2#5351

Open
answndud wants to merge 1 commit intospring-projects:mainfrom
answndud:codex/json-line-mapper-jackson2-5330
Open

Restore JsonLineMapper compatibility with Jackson 2#5351
answndud wants to merge 1 commit intospring-projects:mainfrom
answndud:codex/json-line-mapper-jackson2-5330

Conversation

@answndud
Copy link
Copy Markdown

Fixes #5330

JsonLineMapper currently instantiates Jackson 3's JsonMapper by default, which makes the default constructor unusable when only Jackson 2 is present on the classpath.

This change updates JsonLineMapper to:

  • keep the existing Jackson 3 constructor
  • add a Jackson 2 ObjectMapper constructor
  • fall back to Jackson 2 when Jackson 3 is not available
  • add regression tests for both the explicit Jackson 2 constructor and the default-constructor fallback path

Tests:

  • ./mvnw -pl spring-batch-infrastructure -Dtest=org.springframework.batch.infrastructure.item.file.mapping.JsonLineMapperTests test

@quaff
Copy link
Copy Markdown
Contributor

quaff commented Mar 19, 2026

I don't think it's a good idea to mix usage of two version of Jackson, it's better to write your own JsonLineMapper if you insist on using Jackson2 for Spring Batch 6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to use JsonLineMapper with Jackson 2

2 participants