I am using Jackson to serialize POJOs. I wrote a custom serializer for string values, and it works fine.
However I am not sure what happens, when two serializers are registered for the same type. In my tests the last one added was used, but I am not sure whether it works that way all the time or not.
So my question is: if I add multiple serializers for the same type, which one will be used?
Code snippet:
objectMapper = new ObjectMapper();
SimpleModule module = new SimpleModule();
module.addSerializer(new CustomSerializer1());
module.addSerializer(new CustomSerializer2());
...
class CustomSerializer1 extends NonTypedScalarSerializerBase<String>
class CustomSerializer2 extends NonTypedScalarSerializerBase<String>