public class MyController {
Map<Integer,Param> paramMap = new HashMap<>();
@RequestMapping("/getUser/{param}")
public User getUser(@PathVariable Param param){
return service.doSomething(param);
}
class Param{
int paramId;
String ortherField1;
String ortherField2;
}
}
假如{param}是int,怎么样才能在@PathVariable 处理这步可以直接让传过来的int参数通过从paramMap里拿转为Param类,是什么原理,有什么博客可以推荐一下吗?