Skip to content

Unable to parse fields having a "@" prefix inside @JsonProperty value after upgrading jackson jars to 2.17.0 #721

Open
@zenith7781

Description

@zenith7781

Hello, I am writing this after searching in the issues but couldn't get the required information.
I am using a spring boot project and I have a job where we feed an XML as input and the application processes it and returns the output. I have upgraded Spring boot to 3.3.7 which has automatically upgraded jackson jars to 2.17.3. However post this upgradation, I am facing an issue where jackson is not able to map/serialize the fields correctly. The mapping is defined as ::

@SuppressWarnings("javadoc")
@XmlAccessorType(XmlAccessType.FIELD)
@JsonPropertyOrder({"tc", "$"})
public class CodeCommandType implements Serializable {
  private static final long serialVersionUID = 1L;
  @XmlAttribute
  @JsonProperty("@tc")
  public int tc;
 @XmlValue
  public String $;
}

Sample XML Input:

<ns:RequestBasis id="RequestBasis_1">
        <ns:BasisName>Best of Current and State Non-Forfeiture</ns:BasisName>
        <ns:InterestAssumption tc="2">Current</ns:InterestAssumption>
        <ns:GtdPayoutAmt>194.24</ns:GtdPayoutAmt>
</ns:RequestBasis>

The error is thrown as "Unrecognized field "tc" (class org.rest.of.the.package.CodeCommandType), not marked as ignorable (2 known properties: "", "@tc"]) at [Source: (StringReader); line: 7, column: 27] "

Note that this issue gets resolved if I forcefully keep jackson to 2.16.2 OR put @JsonProperty("tc") instead of @JsonProperty("@tc").

I want to know the commit/issue/changelog or any related information where this configuration was updated inside 2.17.0 release. @cowtowncoder @JooHyukKim Any help will be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions