@ResponseBody
//@RequestMapping(name = "getScreenRecordListByHipJointEntity",method = RequestMethod.POST)
@PostMapping("getScreenRecordListByHipJointEntity")
public PageResult getScreenRecordListByHipJointEntity(@RequestBody HipJointVo hipJointVo){
return hipJointScreenService.getScreenRecordListByHipJointEntity(hipJointVo);
}
when i request this Api which use PostMapping annotation,the result code is ok and nothing wrong.
but when i replace the annotation @PostMapping("getScreenRecordListByHipJointEntity") with @RequestMapping(name = "getScreenRecordListByHipJointEntity",method = RequestMethod.POST),HTTP request code is 404.
the requestBody have nothing change,all the data is exactly the same.
and this is how i do the post request in postman
CodePudding user response:
The problem is that you're using the name parameter of @RequestMapping, which isn't what you're intending. Instead, you should use value (which is the default parameter the value is applied to if you don't specify, as in your @PostMapping version) or path (which is a Spring alias to make the code more readable).
CodePudding user response:
@RequestMapping and @PostMapping's default parameter is value and value is aliasFor path. Both parameter are for path mapping.
@PostMapping("getScreenRecordListByHipJointEntity") ==
@RequestMapping(value = "getScreenRecordListByHipJointEntity", method = RequestMethod.POST)
