I want to change my serializer to jackson, so I could change timestamp format, i tried like this:
@Provider
@Produces(MediaType.APPLICATION_JSON)
public class JacksonConfig
implements ContextResolver<ObjectMapper> {
private final ObjectMapper objectMapper;
public JacksonConfig() {
objectMapper = new ObjectMapper();
objectMapper.setDateFormat(new ISO8601DateFormat());
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS,
false);
}
@Override
public ObjectMapper getContext(Class<?> objectType) {
return objectMapper;
}
}
and in ApplicationConfig :
resources.add(com.rfid.server.helpers.JacksonConfig.class);
It didn't work, I still get timestamps formatted like his: 2014-12-12T17:52:33.35031+02:00"
I tried debugging JacksonConfig
, breakpoint comes to the constructor, but not getContext
method