首页 > 数据库> > redis序列化LocalDateTime时报错 报错信息:Could not read JSON: Cannot construct instance of `java.time.LocalDate
redis序列化LocalDateTime时报错 报错信息:Could not read JSON: Cannot construct instance of `java.time.LocalDate
作者:互联网
在SSM中,向Redis中存入信息后,在取出的时候出现
org.springframework.data.redis.serializer.SerializationException:
Could not read JSON: Cannot construct instance of java.time.LocalDateTime (no Creators, like default construct,exist):
no String-argument constructor/factory method to deserialize from String value (‘2019-11-13 18:05:32’)
错误,是因为序列化时失败,在失败的字段,也就是实体类中时间属性,添加上以下注解
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
标签:java,String,construct,报错,LocalDateTime,using,序列化 来源: https://www.cnblogs.com/daoyih/p/15140826.html