Converter from @PathVariable DomainObject to String? (using ControllerLinkBuilder.methodOn)
I'm trying to call Spring's ControllerLinkBuilder.methodOn() with a non-String type, which always fails. And I don't know which kind of Converter to use and where to register it. Here's my Controller: @RestController @RequestMapping("/companies") class CompanyController { @RequestMapping(value="/{c}", method=RequestMethod.GET) void getIt(@PathVariable Company c) { System.out.println(c); Link link = linkTo(methodOn(getClass()).getIt(c)); } } The System.out.println(c) works well. My Company Domain object get's fetched from DB. (I'm using DomainClassConverter ) But the other way doesn't work: