【异常】: Java 8 date/time type `java.time.LocalTime` not supported by default: add Module

发布时间:2026/6/6 4:46:26

【异常】: Java 8 date/time type `java.time.LocalTime` not supported by default: add Module 问题Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Java 8 date/time type java.time.LocalTime not supported by default: add Module com.fasterxml.jackson.datatype:jackson-datatype-jsr310 to enable handling (through reference chain: User[startTime])解决方案public class ProblemConfigInfo { JsonSerialize(using LocalTimeSerializer.class) JsonDeserialize(using LocalTimeDeserializer.class) private LocalTime startTime; JsonFormat(shape JsonFormat.Shape.STRING, pattern HH:mm:ss) private LocalTime endTime; // getter和setter方法 }

相关新闻