使用杰克逊默认编写器时,如下所示:
protected static String getAsJson(Class clazz, Object object) throws IOException {
ObjectWriter ow = objectMapper.writerWithType(clazz);
return ow.writeValueAsString(object);
如下注释被忽略:
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalDate")
private LocalDate date;
如何手动实现与 springs 一起使用的默认 jackson 序列化@Responsebody
(与注释一起正常工作)?