Problem of repetition

Java 8 date/time type `java.time.LocalDateTime` not supported by default:
 add Module "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable handling....
Copy the code

By default, Java does not support LocalDateTime 8. Need to add the com fasterxml. Jackson. The datatype: Jackson – datatype – jsr310 dependency

Cause: No serializers and deserializers added

The solution

Add the dependent

<dependency>
    <groupId>com.fasterxml.jackson.datatype</groupId>
    <artifactId>jackson-datatype-jsr310</artifactId>
    <version>2.13.0</version>
</dependency>
Copy the code

Specifies the LocalDateTime serializer and deserializer

@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
Copy the code

Such as: