Using Jackson annotations in java-library (not application)
NickName:William Rosenbloom Ask DateTime:2022-08-14T10:44:13

Using Jackson annotations in java-library (not application)

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.

  1. Will the annotations' functionality get exported by the library (like api)?
  2. Will a dependent application be able to use the an ObjectMapper created by the default constructor? Is any further configuration necessary?
  3. 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

More about “Using Jackson annotations in java-library (not application)” related questions

Using Jackson annotations in java-library (not application)

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

Show Detail

Trouble using Jackson annotations

I'm writing a java EE application using JPA. For convenient JSON output I need some specific Jackson annotations. However, none of the Jackson annotations I'm trying seems to work. I guess I'm doing

Show Detail

Jackson annotations tutorials?

Does somebody aware of some good jackson annotations tutorials? Especially, how do you parse json array using jackson annotations? Suppose I have json like this: { ... "item1": "aaa", "item2": "

Show Detail

Jackson 2.0 compatibility with Jackson 1.x annotations?

I have an older framework class that is annotated with jackson 1.x. My application uses jackson 2.0 to handle json serialization. Is it possible to configure jackson 2.0 to understand the "old"

Show Detail

Wildfly ignoring jackson annotations and not using @Provider class

I have looked around here and don't think this is a duplicate of any of these: using Jackson annotations in Wildfly jackson annotations being ignored Wildfly and Jackson @JsonIgnore annotation ...

Show Detail

using Jackson annotations in Wildfly

I'm struggling to get Jackson Annotations to work in my project which is deployed in wildfly. I already tried implementing a MessageBodyWriter but no success. My project looks like this: I have an...

Show Detail

Parsing Jackson annotations with Swagger

By default, Swagger parses a class's data members in order to document the objects used as parameters or returned by a given web service. If you're using Jackson, the Jackson annotations provide a ...

Show Detail

Jackson annotations quarkus resteasy client

I have a client package where I have defined my REST clients, containing the following interface and models: @Path("/") @RegisterRestClient(configKey = "some-api") public interf...

Show Detail

jackson and jax-rs annotations

I am using Jackson to implement a simple REST API. Because it is the first time, I would like to be sure that I am following the correct practice. Looking various examples, I found annotations

Show Detail

Use Jackson JSON processor without using annotations

I have a package which just includes and xsd file to generate (via JAXB) shared classes which are relevant for our server and client applications. So these classes contain XML annotations. One cli...

Show Detail