Reputation: 3166
This is the opposite of what most Spring users are clamoring to do, but I was wondering if its possible to specify that Jackson 1.9.7 be used by Spring (3.1.2) and NOT Jackson 2+.
The project I'm working on relies on other projects that use Jackson 2, so it get pulls in as a transitive dependency. From there Spring picks it up to handle JSON serialization. This in turn borks my application because of custom annotations I've created that require the Jackson version be 1.9.7.
Upvotes: 1
Views: 465
Reputation: 116492
Not sure if this helps, but note that you can also add both Jackson 1 and Jackson 2 annotations in value classes. I have done this at work, to help transition from Jackson 1.9 to Jackson 2.x. And in fact different parts of code use different version: unit test helper methods were migrated first, and later on production code, section by section.
As with library version, use of two sets of annotations is not optimal, but doing so may help reduce risk of version upgrade.
Finally, it is also possible to use an AnnotationIntrospector
that can use both sets of annotations (I don't have a link at hand, but I know a Jackson user published version he created); usually Jackson 2 JacksonAnnotationIntrospector
that also recognizes Jackson 1 annotations. This avoids duplication of annotations and makes it possible to upgrade code first, then convert annotations.
Upvotes: 1