spring-projects / spring-projects/spring-hateoas
Expose Configuration for ControllerLinkBuilder
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 476
- PR merge metrics
- No merged PRs in 30d
Description
ControllerLinkBuilder uses some configurable components but they are not exposed for clients. For example, if one is using a domain object in a controller method and wants to generate a URI from the method, they cannot do so. For example:
BookSearch search = new BookSearch("author:johnson genre:technical");
Link link = linkTo(methodOn(BookController.class).fetchBooks(search)).withSelfRel();
The above, without the ability to get into the internal factory of ControllerLinkBuilder and configure a custom UriComponentsContributor, the resulting URI would look like this:
/books
When it is expected to look like this:
/books?search=author:johnson%20genre:technical
I've tried a bunch of techniques to solve this and so far the only solution is very bad: create a bean that will use reflection to get access to the internal factory and register UirComponentsContributors during startup.
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.
Research direction
Start by locating ControllerLinkBuilder and its internal factory, then trace how UriComponentsContributor instances are configured. Define a supported way for clients to register a custom contributor without reflection, and verify that the BookSearch example produces the expected encoded query URI.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100