我有一个问题:会有三个子类 Student,Teacher,Parent。
public class Person implements Serializable{
private String name;
private String address;}
学生:
public class Student extends Person {
private String cardNo;
}
弹簧休息:
@RequestMapping(method = RequestMethod.POST, value = "/create")
@ResponseBody
public CemeteryRestResponse<Boolean> create(
@RequestBody Person person) throws Exception {.....}
我想使用 one rest 方法来创建这三个角色。但在客户 post Student as JSON 中,它会引发 Exception :
org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "cardNo"
提前致谢!