1.单参数接收 @RequestMapping(value = "/v1/{cate}",method = RequestMethod.GET)public String dynApiDemo2(@PathVariable("cate")String cate){ String cateUrl = map.get("cate"); return "v1/"+cateUrl;} 2.多参数Map接收 @RequestMapping(val
1.单参数接收
@RequestMapping(value = "/v1/{cate}",method = RequestMethod.GET)public String dynApiDemo2(@PathVariable("cate")String cate){ String cateUrl = map.get("cate"); return "v1/"+cateUrl;}2.多参数Map接收
@RequestMapping(value = "/{version}/{cate}/{article}",method = RequestMethod.GET)public String dynApiDemo(@PathVariable Map<String, String> map){ String version = map.get("version"); String cateUrl = map.get("cate"); String articleUrl = map.get("article"); return version+"/"+cateUrl+"/"+articleUrl;}3.正则接收
@RequestMapping(value = "/regexp/{name:\\w}",method = RequestMethod.GET)public String dynApiDemo3(@PathVariable("name")String name){ System.out.println(name); return "";}如果本文帮到你了,欢迎关注本人公众号:周三想吧