I am writing a java-library
that will be included included as a dependency in other projects. I want some of the library's classes to de/serializable with Jackson's ObjectMapper
. Out of habit, I have used annotations to tell Jackson how to de/serialize my classes.
- Will the annotations' functionality get exported by the library (like
api
)?
- Will a dependent application be able to use the an
ObjectMapper
created by the default constructor? Is any further configuration necessary?
- Can I put the annotations into a custom Jackson
Module
for dependent applications to register with their ObjectMapper?
I have been very surprised to find a dearth of documentation for this use case.
Copyright Notice:Content Author:「William Rosenbloom」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/73348828/using-jackson-annotations-in-java-library-not-application