I have an entity in my application that have a composed ID.
In my controller I get this entity using the @PathVariable
in this way:
@RequestMapping("/{year}/{code}")
public MyCustomObj get(@PathVariable Integer year, @PathVariable Integer code){
return myCustomObjRepository.findOne(new CustomId(year, code));
}
Is it possible, using some component like WebArgumentResolver
, to make my method works in this way:
@RequestMapping("/{customObj}")
public MyCustomObj get(@PathVariable CustomId id){
return myCustomObjRepository.findOne(id);
}
having a the URL like: /application/2013/06