Use Jackson 3 with Jersey - #51935
Closed
rene-schakmann wants to merge 1 commit into
Closed
rene-schakmann wants to merge 1 commit into
rene-schakmann wants to merge 1 commit into
Conversation
Jersey 4.0.3 provides jersey-media-json-jackson3. This commit upgrades to Jersey 4.0.3 and switches spring-boot-jersey and spring-boot-starter-jersey from Jackson 2 to Jackson 3. When a single JsonMapper bean is available, JerseyAutoConfiguration now registers Jersey's Jackson 3 JacksonFeature along with a ContextResolver for the JsonMapper. Actuator endpoints use the EndpointJsonMapper for OperationResponseBody instances. JAXB annotation support is provided by the auto-configured JsonMapper's module discovery so no additional customization is required. The existing Jackson 2 support is retained and continues to apply when jersey-media-json-jackson is used in place of jersey-media-json-jackson3. See spring-projectsgh-51931 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: rene.schakmann <rene.schakmann@reetgroup.com>
Member
|
Thanks for the PR, but #51936 appears to be more complete.
Unfortunately, I don't think this is a good way to contribute. If we wanted a Claude-generated contribution, we could do so ourselves. By all means use an LLM if you wish, but the resulting code, commit message, and PR description should be reviewed and edited such that it's as if it had been written by hand. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jersey 4.0.3 added
jersey-media-json-jackson3. This PR upgrades to Jersey 4.0.3 and switchesspring-boot-jerseyandspring-boot-starter-jerseyfrom Jackson 2 to Jackson 3.Closes #51931
Changes
jersey-media-json-jackson3, so it isn't a plain version bump.spring-boot-jerseynow depends onjersey-media-json-jackson3instead ofjersey-media-json-jackson.spring-boot-starter-jerseynow depends onspring-boot-jacksoninstead ofspring-boot-jackson2.JerseyAutoConfigurationregisters Jersey's Jackson 3JacksonFeatureand aContextResolver<JsonMapper>when there's a singleJsonMapperbean. Jersey's Jackson 3 provider looks upContextResolver<JsonMapper>, notContextResolver<ObjectMapper>.JerseyWebEndpointManagementContextConfigurationregisters aContextResolver<JsonMapper>backed byEndpointJsonMapperforOperationResponseBodytypes. This mirrors the existingEndpointJackson2ObjectMappersupport.JsonMapperalready registersJakartaXmlBindAnnotationModulethroughfindAndAddModules, and an explicit customizer would add a second introspector. The@XmlTransientassertion inJerseyAutoConfigurationJsonMapperProviderTestscovers this end to end.jersey-media-json-jacksonin place ofjersey-media-json-jackson3. Both Jersey modules register a feature under the samejersey.config.jsonFeaturename (JacksonFeature), so they shouldn't be on the classpath together. For that reason the Jackson 2 module is nowcompileOnly. Its tests moved toJerseyAutoConfigurationJackson2Tests, which uses@ClassPathExclusions/@ClassPathOverrides.falsetest now follows the WebFlux equivalent.Notes for reviewers
jersey-media-json-jackson:4.0.3in@ClassPathOverrides, so it will need updating on Jersey upgrades. I'm happy to change this or drop the Jackson 2 support if you'd rather remove it.Verification
All pass with 0 failures: 78 tests in
spring-boot-jersey, 24 + 50 in the Jersey smoke tests, and 361 in the actuator integration tests.🤖 Generated with Claude Code