Skip to content

Support for creating lightweight clients without a dependency on spring core components. #1926

Open
@dnavre

Description

@dnavre

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:

  1. Are using older versions of spring (conflicts on spring dependency versions)
  2. Are delivered as a shaded jar (the jar becomes too big)
  3. 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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions