This example works fine for me in my eclipse. However, when I have changed the Person class to the following :
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 :
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”
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.