Usually my first guess is that configured `ObjectMapper` is not being
used at all.
So if you can re-configure mapper in some other way (like default to
indenting or something) maybe you can eliminated the possibility that
this mapper is not being used?

Another small thing is that `findAndRegisterModules()` is only needed
if you want to install every module that may be in classpath: for
explicitly registered one (like `calendarModule` here) it is not
needed. But that should not cause problems here unless some other
module happened to override your definitions (and since it's caller
after, it seems unlikely too, as that uses "append" not "insert", I
think).

-+ Tatu +-


On Fri, Feb 17, 2017 at 11:03 AM, Nikhil Agrawal <nikhil...@gmail.com> wrote:
> Hi,
>
> I am trying to use jackson as jackson-jaxrs-providers. I want to provide the
> custom serializer and deserializer for java.util.Calendar data type. I have
> the following code. I have omitted few lines for the sack of brevity.
>
>                 JAXRSServerFactoryBean factory = new
> JAXRSServerFactoryBean();
>                 List<Object> providers = new ArrayList<Object>();
>                 //Defining the provider
>                 JacksonJsonProvider jsonProvider = new
> JacksonJsonProvider();
>        ObjectMapper mapper = new ObjectMapper();
>        SimpleModule calendarModule = new SimpleModule("CalendarModule", new
> Version(1, 0, 0, null, null, null));
>        calendarModule.addSerializer(Calendar.class, new
> CalendarJsonSerializer());
>        calendarModule.addDeserializer(Calendar.class, new
> CalendarJsonDeserializer());
>        mapper.registerModule(calendarModule);
>        mapper.findAndRegisterModules();
>        jsonProvider.setMapper(mapper);
>                 providers.add(jsonProvider);
>
> But it seems my serializer and deserializers are not getting called as I
> have setup the debug points in serializer and deserializer codes.
>
> Any pointers will be of great help.
>
> --
> You received this message because you are subscribed to the Google Groups
> "jackson-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jackson-user+unsubscr...@googlegroups.com.
> To post to this group, send email to jackson-user@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jackson-user+unsubscr...@googlegroups.com.
To post to this group, send email to jackson-user@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to