-
Notifications
You must be signed in to change notification settings - Fork 472
ControllerLinkBuilder.linkTo fails to build a link to a method that uses entity as a target of @PathVariable in its signature #352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
For a Spring data rest project, you should not use RestController. See spring-projects/spring-data-rest#177 for documentation updates on the proper way to build overriding controllers. |
Thanks a lot for the quick turnaround and the hint on Still, it does not solve the initial concern of having an ability to generate links to methods where |
I don't understand how |
To clarify on the |
Spring Data JPA reference documentation says that
|
Just ran into this issue as well. I have a controller that has MyDomainId as a parameter. I have registered a Converter<String,MyDomainId>, but when passing the instance of MyDomainId into the linkTo method, I receive the same error @vtsukur posted above. Registering a Converter<MyDomainId,String> converter did not solve the issue. FYI I'm not using SpringData, just Spring Hateoas. |
I have a similar issue. It seems to be the same for other annotations like This is a bad show stopper for me! |
Existing ConversionService is fixed as a static inside BoundMethodParameter. This introduces ability to inject an alternative ConversionService. Related issues: #352
The issue is that the existing conversion service is baked into Spring HATEOAS. There is currently no means to pick up and inject your own. |
Hello @vtsukur |
I've been able to get around this error using a hack - creating a String based constructor on the object with a toString().... This will get picked up by a default converter FallBackObjectToStringConverter I use a Hashid based argument in a controller method, encapsulated in an object (similar concept to @aglassman's MyDomainId) and it's annoying i have to use this hack till a real solution is out... |
According to this thread, these cases are not working:
To add to the list, I have another case that is not working.
Hateoas in this case would completely ignore any This might even be more dangerous than the previously mentioned issues, because there's no exception. Is any of this fixable?! |
Duplicates #118. |
Consider a project using Spring Data JPA / Spring Data REST to manage an entity
MyEntity
via repository annotated with@RepositoryRestResource
:Consider the following (custom) Spring MVC controller in such an application:
and the following
ResourceProcessor
:ResourceProcessor
will fail to generate the link avoiding the knowledge and capabilities ofDomainClassConverter
and@PathVariable
The text was updated successfully, but these errors were encountered: