【发布时间】:2017-10-02 12:31:33
【问题描述】:
这个问题与this SO problem 非常相似,后者适用于较早的Date API。
我想用 Java 8 LocalDateTime API 实现同样的效果。当我这样做时,
@RequestMapping("/locationSnapshot/{userId}/{pointInTime}")
public MyResponse getLocationInTime(
@PathParam(value="userId") Long userId,
@PathParam(value="pointInTime")
@DateTimeFormat(pattern="yyyy-MM-dd'T'HH:mm:ss") LocalDateTime pointInTime) {
MyResponse response = new MyResponse();
return response;
}
我明白了,
Failed to instantiate [java.time.LocalDateTime]: No default constructor
found; nested exception is java.lang.NoSuchMethodException:
java.time.LocalDateTime.<init>()
【问题讨论】: