记录一下springboot封装前台接口localdatetime
在公司做项目的时候发现前台传字符串“2021-04-12 12:00:00”字符串时,后台使用localdatetime接收,报错
org.springframework.http.converter.HttpMessageNotReadableException: Invalid JSON input: Cannot deserialize value of type `java.time.LocalDateTime` from String "2020-05-04 00:00": Failed to deserialize java.time.LocalDateTime: (java.time.format.DateTimeParseException) Text '2020-05-04 00:00' could not be parsed at index 10; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `java.time.LocalDateTime` from String "2020-05-04 00:00": Failed to deserialize java.time.LocalDateTime: (java.time.format.DateTimeParseException) Text '2020-05-04 00:00' could not be parsed at index 10
// 省略部分异常信息
Caused by: java.time.format.DateTimeParseException: Text '2020-05-04 00:00' could not be parsed at index 10