错误信息:
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Java 8 date/time type `java.time.LocalDateTime` not supported by default: add Module "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable handling (through reference chain: com.xx.xx.vo.redis.User["对应字段"])
1、增加pom依赖文章来源:https://www.toymoban.com/news/detail-678958.html
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
2、对应字段增加属性文章来源地址https://www.toymoban.com/news/detail-678958.html
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss:SSS")
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
到了这里,关于Redis添加LocalDateTime时间序列化/反序列化Java 8报‘jackson-datatype-jsr310’问题的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!