遵循Krams的例子。下面返回什么,Person 对象会根据提交请求的标头转换为 JSON 还是 XML?
@RequestMapping(value = "/person",
method = RequestMethod.POST,
headers="Accept=application/xml, application/json")
public @ResponseBody Person addPerson(@RequestBody Person person) {
logger.debug("Provider has received request to add new person");
// Call service to here
return personService.add(person);
}
因此,当我将数据作为 json 提交时,我会返回 json,对于 xml 也是如此。还是发生了其他事情?