前臺jason 和後臺@Requestbody不匹配

You need to replace @ModelAttribute with @RequestBody and of course have the Jackson 2.x library on the classpath.post

You will also need to add @JsonIgnoreProperties(ignoreUnknown = true) to TestResourcespa

@JsonIgnoreProperties(ignoreUnknown = true)
public class TestResource {
   //all the rest of your code
}

because the Link you are posting contains properties that the Link object does not contain.rest

As was very correctly mentioned by OP, the @JsonIgnoreProperties annotation needs to be imported from com.fasterxml.jackson.annotation not from org.codehaus.jackson.annotate since the latter is from Jackson 1.xcode

相關文章
相關標籤/搜索