-
Notifications
You must be signed in to change notification settings - Fork 476
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
Support for creating lightweight clients without a dependency on spring core components. #1926
Comments
Thanks for bringing this up. The reason that we haven't explored this in greater detail is that, for one, Spring HATEOAS primary environment is indeed Spring Boot applications and, for the other, that not too many people were asking for this before, we currently don't have a good feel for where to draw the lines and a potential split up also comes with a couple of downsides. Let me elaborate:
Now that I have outlined all the challenges, let me make sure that I am still not opposing the idea to exploring other arrangements. We essentially need to find a good way to come to a new tradeoff, that still is a good balance for all parties involved. I wonder if you can elaborate on what APIs exactly your client libraries use to be able to vet what different dependency arrangement a potential artifact arrangement would result in and whether you'd consider this an improvement over the current situation? |
For some context, I am/was planning to use the client library in a big data processing application such as Apache Spark/Flink. The thing with these platforms is that one is already forced to use shaded jars and having all the Spring dependencies also sitting inside is an inconvenience. Moreover, in our example we're forced to use the client library in Java_11 context which the current structure of the hateoas project very efficiently makes impossible :) Our API is quite simple, it doesn't have many objects linking to each other and overall things are not far from a regular REST API. Regardless, we ended up generating the client library from scratch using the OAS v3 spec, then we had to do some manual tweaking to make the generated code actually work. Of course this is a terrible solution, the generated classes are lacking in many ways compared to the DTO layer we have already created for the API, future re-generations of the client will also involve additional manual work to make it workable. But this was the only reasonable way to make it work we could think of. As for the points you raised:
I'm sorry for the really long post. I also understand that achieving this with HATEOAS is more complex than with REST or even GraphQL. I also want to say thank you for all the wonderful libraries, including HATEOAS, you guys have created for the community over the years! |
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 mainGradle: 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:
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.
The text was updated successfully, but these errors were encountered: