我的程序是用Java編寫的8,當我使用LocalDateTime的類型,它會給我下面的錯誤沒有合適的構造函數:發現型[簡單類型,類java.time.LocalDateTime]
No suitable constructor found for type [simple type, class java.time.LocalDateTime]: can not instantiate from JSON object (missing default constructor or creator, or perhaps need to add/enable type information?)
at [Source: [[email protected]; line: 1, column: 80] (through reference chain: com.boot.framwork.entity.UserInfo["accessTime"])
實體是這樣的:
public class UserInfo implements Serializable {
private static final long serialVersionUID = 1L;
private String username;
private int age;
private LocalDateTime accessTime;
private Date time;
private List<String> list = new ArrayList<String>();
private boolean isMarried;
public UserInfo() {
}
它工作時,我沒有使用LocalDateTime
我使用redis作爲緩存 – Terry