Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/397.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 序列化接收到的数据类型为';LocalDateTime';_Java_Spring Boot - Fatal编程技术网

Java 序列化接收到的数据类型为';LocalDateTime';

Java 序列化接收到的数据类型为';LocalDateTime';,java,spring-boot,Java,Spring Boot,我有一个类Dto,它将设置一个数据类型为LocalDateTime的值 我收到JSON时出错 public class Dto { @JsonFormat(shape = JsonFormat.Shape.STRING) private LocalDateTime scheduledStartTime; } } 以下是错误: Cannot construct instance of `java.time.LocalDateTime` (no Creators, like defau

我有一个类Dto,它将设置一个数据类型为
LocalDateTime
的值

我收到JSON时出错

public class Dto {

@JsonFormat(shape = JsonFormat.Shape.STRING)
    private LocalDateTime scheduledStartTime;

}
}
以下是错误:

Cannot construct instance of `java.time.LocalDateTime` (no Creators, like default construct, exist): no String-argument constructor/factory method to deserialize from String value ('2019-08-01T15:30:00Z')
尝试禁用:

objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)


在DTO中接收JSON期间或在发送JSON期间?Im new to Serialization/Deserialization
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonSerialize(using = LocalDateTimeSerializer.class)