有没有人用java.sql.Time能请教一下time怎么用吗。我前端用json传的。结果转换报400. 用Time类型有什么解决方案吗
报错400
警告 [http-nio-8080-exec-6] org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver.logException Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot construct instance of `java.sql.Time`, problem: `java.lang.IllegalArgumentException`; nested exception is com.fasterxml.jackson.databind.exc.ValueInstantiationException: Cannot construct instance of `java.sql.Time`, problem: `java.lang.IllegalArgumentException`
at [Source: (PushbackInputStream); line: 1, column: 79] (through reference chain: com.neusoft.meeting.pojo.Appointment["startTime"])]
实体类加了注解
controller用@RequestBody接收
ajax
$.ajax({
url: '/orderAppointment',
type: 'post',
dataType: 'text',
contentType:'application/json;charset=utf-8',
data: JSON.stringify({
'userUid': userUid,
'roomUid': roomUid,
'appointmentDate': appointmentDate,
'startTime': startTime,
'endTime': endTime,
'state': state
}),
success: function (res) {
if (res == "success") {
layer.msg('预约成功!');
} else {
layer.msg("对不起,预约失败.");
}
}
});