【发布时间】:2015-08-19 14:36:54
【问题描述】:
这是我的网址的样子
http://localhost/controller/check
这里是请求映射
@RequestMapping(method = RequestMethod.POST)
public Data check(@RequestBody final Check checkRequest, final HttpServletResponse servletResponse) {
// service layer
}
现在我希望Check 对象处理以下两个 POJOS。
public class Check {
String name;
String email;
}
public class Check {
int age;
Location location;
}
请求映射应处理以下POST 正文。
{"age" : 23, "location" :{ "region": XXX, "country":"xxx", "zipcode":xxx}
和
{"name": "yyyy", "email":"hello@bar.com"}
这里推荐的方法是什么?
【问题讨论】:
标签: spring spring-mvc spring-restcontroller