Skip to content

Add Jackson 3 support for @JsonDeserialize and @JsonPOJOBuilder#918

Merged
jiholee17 merged 4 commits intomasterfrom
feature/jackson-3-support
Feb 11, 2026
Merged

Add Jackson 3 support for @JsonDeserialize and @JsonPOJOBuilder#918
jiholee17 merged 4 commits intomasterfrom
feature/jackson-3-support

Conversation

@jiholee17
Copy link
Collaborator

Closes #899

This PR adds support for Jackson 3 (now configured by default in Spring Boot 4 projects) by detecting which versions of Jackson annotations are available on the compile classpath and adding annotations for the available version(s). If neither version is found, codegen defaults to Jackson 2 annotations for backwards compatibility. If both versions are found, codegen adds both annotations and defers to runtime selection behavior.

Affected annotations are:

  • @JsonDeserialize in com.fasterxml.jackson.databind.annotation (Jackson 2) and tools.jackson.databind.annotation (Jackson 3)
  • @JsonPOJOBuilder in com.fasterxml.jackson.databind.annotation (Jackson 2) and tools.jackson.databind.annotation (Jackson 3)

@JsonProperty, @JsonTypeInfo, and @JsonSubTypes are unaffected and remain in the com.fasterxml.jackson.annotation package.

Example with both Jackson versions:

import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize as FasterxmlJacksonDatabindAnnotationJsonDeserialize
import tools.jackson.databind.`annotation`.JsonDeserialize as ToolsJacksonDatabindAnnotationJsonDeserialize
...
@JsonTypeInfo(use = JsonTypeInfo.Id.NONE)
@FasterxmlJacksonDatabindAnnotationJsonDeserialize(builder = Country.Builder::class)
@ToolsJacksonDatabindAnnotationJsonDeserialize(builder = Country.Builder::class)
public class Country(
...

Example with single Jackson version:

import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize
...
@JsonTypeInfo(use = JsonTypeInfo.Id.NONE)
@JsonDeserialize(builder = Query.Builder::class)
public class Query(
...

@jiholee17 jiholee17 merged commit 5dfd192 into master Feb 11, 2026
6 of 10 checks passed
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.

Jackson 3 support

3 participants