在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)