问题出现在发布请求中。请求正文中有几个时间戳,除了一个之外,所有时间戳都被 Spring Boot 上的 Rest 服务正确接收。有问题的时间戳的区别在于该字段不是以用户在输入字段中输入数据为代价的,而是从系统时间分配的。在有问题的字段中手动输入数据时,请求正确通过。
todayDate: Date = new Date(Date.now()); // вызываю время и дату
this.callForm.patchValue({
date: [formatDate(this.todayDate,"yyyy-MM-dd",'en' )], // присваиваю полю значение даты
time: [formatDate(this.todayDate,"HH:mm",'en' )] // // присваиваю полю значение времени
})
我称表单域的值:
this.calls.time = this.callForm.get('time').value ; // присваивание полю класса значение формы
在 Spring Boot 中,字段描述代码与其他临时、健康的字段相同。错误:
2020-08-18 12:06:25.443 WARN 5340 --- [nio-8080-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver :
Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize instance of `java.util.Date` out of START_ARRAY token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.util.Date` out of START_ARRAY token
at [Source: (PushbackInputStream); line: 1, column: 22] (through reference chain: com.kiryushin.pspmonitoring.entity.Calls["time"])]