两个不同的POST方法可以映射相同的路径(URI),唯一的区别在于请求正文内容是否相同。
示例
@RequestMapping(value = "/hello", method = RequestMethod.POST)
public String helloEmployee(@RequestBody Employee employee) {
return "Hello Employee";
}
@RequestMapping(value = "/hello", method = RequestMethod.POST)
public String helloStudent(@RequestBody Student student) {
return "Hello Student";
}