I'm trying to serialise a class that belongs to project B from project A using jackson. Since this class has some funny method names I needed to use MixIn annotation to make it serialisable from project A. That worked well, but later I was asked to make this change directly into project B, since we want many other projects to be able to serialise/deserialise this class.
I ended up putting annotation directly into the class, so my class became
public class Dog {
public Dog(@JsonProperty("breed") String colour) {
this.colour = colour;
}
@JsonProperty("breed")
private String colour;
}
This is just an example and it shows what the class looks like. The point here is, when I serialise/deserialise the class inside project B the annotations are picked up and everything works as expected, whilst when I serialise/deserialise inside project A (that has project B as a dependency) the annotations are ignored. Does anybody know why this is happening?