获取请求参数和路径参数
@RestController public class ParamterTestControllr { @GetMapping("/car/{id}/owner/{username}") public Map<String, Object> getCar(@PathVariable("id") Integer id, @PathVariable("username") String username, @PathVariable Map<String,String> pv, @RequestHeader Map<String,String> header, @RequestParam("Age") Integer age)//获取路径变量的值,也可以直接map接收,必须两个string,requestParam获取请求参数的值 { Map<String,Object>map=new HashMap<>(); map.put("id",id); map.put("name",username); map.put("pv",pv); return map; } }