我的REST API方法是:
@RequestMapping(value = "/api/test/summary", method = RequestMethod.POST)
postSummaryData(@RequestBody String one, @RequestBody String two) { ... }
答案 0 :(得分:0)
@RequestMapping(value =“/ api / test / summary / {one} / {two}”,method = RequestMethod.POST)postSummaryData(@RequestParam String one,@ RequestParam String two){ }
您也可以尝试以下:
@RequestMapping(value =“/ api / test / summary”,method = RequestMethod.POST)postSummaryData(){
RequestAttributes attr = RequestContextHolder.getRequestAttributes();
HttpServletRequest request =((ServletRequestAttributes)attr).getRequest();
//你可以从这个请求获得参数
}