今天用postman测试接口的时候遇到了这个错误
"Type definition error: [simple type, class com.example.mall.pojo.User]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.example.mall.pojo.User` (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)\n at [Source: (PushbackInputStream); line: 2, column: 5]",
排查结果:实体类中当定义了有参构造、又没有补充上无参构造的情况
{
"username":"admin2",
"password":"1234",
"email":"hzcdd@qq.com"
}
public User(String username, String password, String email, Integer role) {
this.username = username;
this.password = password;
this.email = email;
this.role = role;
}
public User() {
}