java - Custom deserializer for JodaTime not workin in Spring MVC -


after "text" itemprop = "text">

I use a custom jackson serializer to try JSON Joda's date time object to convert according to my desired format I am doing. Beam id = "jacksonmessageChanger" class = "org.springframework.http.converter.json;

  & lt: I would like to comment on every case so I can configure it globally MappingJacksonHttpMessageConverter "& gt; & Lt; Property Name = "Supported MediaTaps" value = "App / JSON" /> & Lt; Property name = "objectmapper" ref = "jackson objectmapper" /> & Lt; / Bean & gt; & Lt; Bean id = "Jackson ObjectMaper" class = "com.myapp.CustomJacksonObjectMapper" />  

My custom map class:

  Public class CustomJacksonObjectMapper extends ObjectMapper {public CustomJacksonObjectMapper () {CustomSerializerFactory factory = new CustomSerializerFactory (); Factory.Educational Mapping (Datetime, Class, New Daytime Surgery); This.setSerializerFactory (factory); }}  

And finally my serializer:

  Public class DateTimeSerializer extends JsonSerializer & LT; Date Time & gt; {Private Static DateTimeFormatter Format = DateTimeFormat.forPattern ("dd-mm -yyyy"); Private Static Logger Logger = LoggerFactory.getLogger (DateTimeSerializer.class); @Override Public Zero Serialize (DATETIME Value, JsonGenerator jgen, SerializerProvider Provider) IOException, JsonProcessingException {String throws formattedDate = formatter.print (value); Logger.debug ("change date string: {}", formatted data); Jgen.writeString (formattedDate); }}  

But every time I try, I could not cancel the exception. What am I doing wrong?


Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -