Hi,

Thanks for the reply. I tried removing the findAndRegisterModules call but 
even then it didn't work.

What do you meant by "re-configure mapper in some other way". Could you 
please provide some more details?
My guess is that JacksonJsonProvider is not getting used at all. How do you 
I know that?

-Nikhil

On Saturday, February 18, 2017 at 1:13:45 AM UTC+5:30, Tatu Saloranta wrote:
>
> 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 <nikh...@gmail.com 
> <javascript:>> 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...@googlegroups.com <javascript:>. 
> > To post to this group, send email to jackso...@googlegroups.com 
> <javascript:>. 
> > 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