使用@PathVariable可以给url带参数,从而实现动态url的目的,如:
@RequestMapping(value = "/ping/{version}", method = RequestMethod.POST) public @ResponseBody Map<String, Object> test(@PathVariable String version, @RequestBody String body, HttpServletRequest request, HttpServletResponse response) { return null; }
但如果version的值带".",则会被截断,将{version}修改为{version:.+}则可以完美解决。
时间: 2024-11-05 13:32:15