How to receive localdatetime type in background

First, we need to introduce it in the Maven parent POM

<dependency>
     <groupId>com.fasterxml.jackson.datatype</groupId>
     <artifactId>jackson-datatype-jsr310</artifactId>
     <version>2.9.7</version>
</dependency>

Add relevant annotations to the entity class definition, as shown below

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;


@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") // To parse the form data (form/data) data
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") //To parse json data
private LocalDateTime startTime;

Read More: