spring-projects / spring-projects/spring-hateoas
Support for creating lightweight clients without a dependency on spring core components.
@odrotbohm is already working on this.
Since Mar 16, 2023.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 476
- PR merge metrics
- No merged PRs in 30d
Description
I have a spring hateoas API which is being called from non-spring environments where memory usage and even artifact size are of a concern to me. To reduce code duplication I have obviously separated the models/dtos returned by my API into a separate maven module and use this module both in the API and in the non-spring client library. The problem is that the way spring-hateoas is designed in encourages(or maybe requires?) me to extend org.springframework.hateoas.RepresentationModel in my models which is in the main Gradle: org.springframework.hateoas:spring-hateoas dependency. If I add that dependency to my common code it brings with itself all kinds of other spring dependencies. The result is a blown out of proportions client library that has lots of dependencies on spring components.
This is an issue for many cases, including using the client library in projects that:
- Are using older versions of spring (conflicts on spring dependency versions)
- Are delivered as a shaded jar (the jar becomes too big)
- Do not have a dependency on spring (spring becomes a dependency and may even cause conflicts with other 3rd party non-spring libraries, such as logging frameworks, jsonpath library, etc.)
It would be great, if the current hateoas project was split into two modules. One to be used by the API project with all the dependencies to spring's core components and the other without any dependencies whatsoever and just containing the parent classes for API models.
I searched a lot for a solution for this problem but didn't find anything.Have I missed something? Also, as a workaround the only way I see is to copy-paste the the API model parent classes into the API model containing project. However this is a really ugly solution and may even pose legal/licensing issues.
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.