그런데 [methodOn]:1을 사용하려는 데 아래와 같은 오류가 뜨며 Generic을 이용할 수가 없었다.
1
2
3
4
5
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [@org.springframework.web.bind.annotation.PathVariable ?] to type [java.lang.String]
at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:313)
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:195)
at org.springframework.hateoas.mvc.AnnotatedParametersParameterAccessor$BoundMethodParameter.asString(AnnotatedParametersParameterAccessor.java:172)
at org.springframework.hateoas.mvc.ControllerLinkBuilderFactory.linkTo(ControllerLinkBuilderFactory.java:128)
methodOn을 통해 얻은 객체를 캐스팅도 해 보고 별 짓을 다 해봤는데 도무지 문제를 알 수가 없었다.
그런데 문제는 의외로 쉬운 곳에 있었다.
Generic에는 @RestController, @RequestMapping 등을 사용하면 안되는데, 여기도 마찬가지였던 것이다.