[英]resolving com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field
This example works fine for me in my eclipse. 这个例子对我的日食很有效。 However, when I have changed the Person class to the following : 但是,当我将Person类更改为以下内容时:
package com.thejavageek.jaxrs.model;
public class Person {
private int userSelectList;
public int getUserSetSelectList() {
return userSelectList;
}
public void setUserSetSelectList(int userSelectList) {
this.userSelectList = userSelectList;
}
@Override
public String toString() {
return "Person [userSelectSet=" + userSelectList + "]";
}
}
And I tested by passing the JSON like the following : 我通过传递JSON进行了如下测试:
Error: 错误:
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "userSelectList" (class com.thejavageek.jaxrs.model.Person), not marked as ignorable (one known property: "userSetSelectList"])
at [Source: io.undertow.servlet.spec.ServletInputStreamImpl@6418702f; line: 1, column: 20] (through reference chain: com.thejavageek.jaxrs.model.Person["userSelectList"])
Why is it that the example form the link I shared above works fine and not this one? 为什么我在上面共享的链接的示例形式可以正常工作而不是这个?
在您的json中,将“ userSelectList”更改为“ userSetSelectList”,或将您的setter更改为“ setUserSelectList”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.