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:
- Jsonformat annotation solves the problem of time format in the front end of localdatetime
- How do I change the default background color of all FIGURE objects created in MATLAB
- Failed to convert value of type ‘java.lang.String‘ to required type ‘java.util.Date‘;
- How to use scanner to accept char type characters in Java
- Solution: error in the RPC receive loop
- Mutual conversion between date and localdatetime
- [Solved] Flowable Start Error: ClassCastException: java.time.LocalDateTime cannot be cast to java.lang.String
- Windows batch: File running in the background
- Running bat batch file in background
- Error report of xv6 operating system make Makefile:192 : * * solutions to receive comments before first target. Stop
- SAP Spartacus encountered an error in the background of Commerce cloud when using the product configuration function
- On the usage of ‘ref.stor.type search’ field in SAP WM movement type
- How to Solve mybatis returns null when querying Oracle database with char type field
- Error type referred to is not an annotation type:RedisCache
- Use XMLHttpRequest of JavaScript to send data to the background
- Unity Error:InvalidCastException: Cannot cast from source type to destination type.
- The back end cannot receive the parameters passed by the front end
- Traversing the background data to generate tree structure
- Error: (22,57) Java: type parameter… Mapper is not in the range of type variable M