Skip to content

Use Jackson 3 by default in the Jersey starter - #51936

Open
khopland wants to merge 1 commit into
spring-projects:mainfrom
khopland:51931-jercey-jackson-3
Open

khopland wants to merge 1 commit into
spring-projects:mainfrom
khopland:51931-jercey-jackson-3

Conversation

@khopland

@khopland khopland commented Oct 2, 2026 •

Copy link
Copy Markdown

eThe Jersey starter currently uses Jackson 2, so Jersey responses do not use Spring Boot’s default Jackson 3 mapper and configuration.

This change upgrades Jersey to 4.0.3 and uses Jackson 3 by default. Jackson 2 remains available through spring.jersey.preferred-json-mapper=jackson2 like other starters. The preference applies to application and Actuator endpoints, including when Jackson features are already registered.

Adds tests for both mapper versions and Actuator configurations. Jersey module, starter, smoke, and Actuator integration checks pass.

Closes #51931

Upgrade Jersey to 4.0.3 and make Jackson 3 the default JSON mapper.
Keep Jackson 2 support via spring.jersey.preferred-json-mapper=jackson2,
and apply the preference to both application and Actuator endpoints.

Closes spring-projects#51931

Signed-off-by: Kristoffer Larsen Hopland <24739853+khopland@users.noreply.github.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 2, 2026
@khopland

khopland commented Oct 2, 2026

Copy link
Copy Markdown
Author

Oh, I didn’t notice #51935 had already been opened when I created this PR.

Both PRs upgrade Jersey to 4.0.3 and make Jackson 3 the default. With #51935, you switch back to Jackson 2 by replacing dependencies. Here, both versions are included, and you can choose with spring.jersey.preferred-json-mapper, even if the application has already registered Jackson features.

I also added tests for Actuator-only applications and separate management ports. In local testing, an Actuator-only app using spring.jackson.property-naming-strategy=SNAKE_CASE with mapper isolation disabled returned firstName with #51935 and first_name with this PR. A custom EndpointJsonMapper worked on both ports here, but only on the main port with #51935.

Supporting both providers makes this PR bigger. I’m happy to simplify it so switching to Jackson 2 requires replacing dependencies, while keeping the Actuator fixes and regression tests.

@khopland

khopland commented Oct 3, 2026

Copy link
Copy Markdown
Author

A question i have is how a user should select what jackson version jercey should use, i have added the prop spring.jersey.preferred-json-mapper, but it could also be done with dependecy exlusion. And a other question is if it is a breaking change to change the dafault jackson version in jercey starter for the user?

This branch has not been deployed

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

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Switch spring-boot-starter-jersey to use Jackson 3 rather than Jackson 2

2 participants