【发布时间】:2013-06-26 12:27:28
【问题描述】:
我的应用程序中有一个实体,它有一个组合的ID。
在我的控制器中,我以这种方式使用@PathVariable 获取此实体:
@RequestMapping("/{year}/{code}")
public MyCustomObj get(@PathVariable Integer year, @PathVariable Integer code){
return myCustomObjRepository.findOne(new CustomId(year, code));
}
是否有可能,使用像WebArgumentResolver 这样的组件,让我的方法以这种方式工作:
@RequestMapping("/{customObj}")
public MyCustomObj get(@PathVariable CustomId id){
return myCustomObjRepository.findOne(id);
}
有一个类似的 URL:/application/2013/06
【问题讨论】:
-
您介意带有过滤器的 http 重定向吗?
-
Ops...我没看到...所以问题可以结束...谢谢
标签: spring http-request-parameters