I have several microservices built using Spring Boot, so for a bit of fun, I thought I needed to add HATEOAS to them to help set up cross-resource binding. It seems to work very well on a specific project, but I was wondering if there is a good way to link the API. For example, imagine that I have 3 services:
User Data Service: Code:
/users/{userid}
User Calendar Service: Code:
/users/{userid}/appointments /users/{userid}/appointments/{appointmentid}
User messaging service: Code:
/users/{userid}/messages /users/{userid}/messages/{messageid}
To make this view available through the API, it would be nice to have links from a user resource to his meetings and messages. Likewise, it would be nice to have links from these resources. This is very achievable when I have one API with everything in the classpath where I can write code, for example:
the code:
user.add(linkTo(methodOn(CalendarController.class).appointments(user.getKey())).withRel("appointments"))
However, I cannot do this if CalendarController is not in the classpath of the service that I am currently clicking on.
Is there a good / recommended method for creating links to controllers that are not in the current project?
Link to spring forums
spring spring-boot spring-hateoas hateoas microservices
keaplogik
source share