Jersey, JAXB and Jackson ignore XmlTransient in 1.4 but honour it in 1.3.5
See original GitHub issueIn upgrading from spring-boot 1.3.5 including the spring-boot-starter-jersey it went from working to getting this exception:
org.glassfish.jersey.server.internal.process.MappableException: com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion
due to my User > accounts > owner > accounts etc. recursion
In 1.3.5 it honors @XmlTransient but with 1.4.0.SNAPSHOT it doesn’t
According to this: http://wiki.fasterxml.com/JacksonJAXBAnnotations
the jackson-xc library should be added and the JAXB annotation introspector should be registered
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Jersey omits XmlTransient annotation during serialization
In Jackson 2.x it can be achieved with a proper AnnotationIntrospector . Supporting both Jackson and JAXB annotations.
Read more >JAXB Release Documentation - Java EE
Launching xjc; 1.3. xjc Syntax; 1.4. ... JAXB-794 - Classes annotated with @XmlTransient are still mapped to XML ... Regression in Jersey JSON...
Read more >[Jersey] JAXB annotations are ignored while serializing to JSON
I have JAXB annotations on my representations and I'm facing an issue getting Jersey to honor those annotations while serializing to JSON.
Read more >Jackson Ignore Properties on Marshalling - Baeldung
This tutorial will show how to ignore certain fields when serializing an object to JSON using Jackson 2.x.
Read more >replace Jackson specific @JsonIgnore annotation with JAXB ...
replace Jackson specific @JsonIgnore annotation with JAXB @XmlTransient on NeutronObject's setTenantID(Uuid tenantID), but note setTenantID(String tenantID) ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I simplified this a bit too much to get the stack trace, but if you look at the JSON output from calling http://localhost:8080/organizations first with the 1.3.5 then with the 1.4.0 you can see that @XmlTransient is not being honored. Just switch the comments on the spring-boot-version property and parent version in the top-level maven pom.xml.
Here’s some SQL to create sample data:
api-sample.zip
Cool, thanks! I just looked for why Jersey wouldn’t honor JAXB annotations and that was what came up. As long as it produces the same as 1.3.5 I’ll be happy.