一、ReuqestBody 主要是处理json串格式的请求参数,要求使用方指定header content-type:application/json
二、RequestBody 通常要求调用方使用post请求
三、RequsetBody参数,不会放在HttpServletRequest的Map中,因此没法通过javax.servlet.ServletRequest#getParameter获取;
ex:
@RequestMapping(value = "list", method = RequestMethod.POST)
public PageResult getStoresByQuery(@RequestBody StoreBsQuery storeBsQuery) {
PageResult result = new PageResult();
try {
result.setT(storeBsService.getStoreByQuery(storeBsQuery));
result.setCount(storeBsService.getCountByBsQuery(storeBsQuery).intValue());
} catch (Exception e) {
logger.error("StoreBsService.getStoresByQuery error", e);
}
return result;
}