spring-projects / spring-projects/spring-hateoas
linkTo with inheritance - @PathVariable from parent is ignored
@odrotbohm is already working on this.
Since Jan 12, 2023.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 476
- PR merge metrics
- No merged PRs in 30d
Description
Given the following classes, ControllerLinkBuilder.linkTo(methodOn(FooApiImpl.class).getFoo("someId")) ignores the path param.
public interface FooApi {
@RequestMapping(value = "/foos/{foo-id}", method = RequestMethod.GET)
ResponseEntity<Foo> getFoo(@PathVariable(value="foo-id") String fooId);
}
@Controller
@RequestMapping("/basePath")
public class FooApiImpl implements FooApi {
public ResponseEntity<Foo> getFoo(String fooId){
// ...
}
}
The generated Link looks like http://localhost:8080/basePath/foos/{foo-id}
If I copy the @PathVariable to the param in FooApiImpl, the link looks like it should: http://localhost:8080/basePath/foos/someId
Calling linkTo on the FooApi class also works, but obviously ignores the basePath from the @RequestMapping from FooApiImpl.
I'm using spring-hateoas 0.25.2.RELEASE.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.