This module contains API interfaces and Spring beans to simplify using Rhyme to build a HAL microservice as a Spring Boot application.
Simply add this module as a dependency to your Spring Boot project, and the extensions explained below should become effective through auto-configuration.
It currently doesn't give you much control to configure or replace the default behaviour that will become effective through auto-configuration by simply adding this module as a dependency.
If you want to use Rhyme in an existing application, there are some areas where it can break your application (e.g. exception handling). Also the integration module relies on @RequestScoped
beans, so it may not be suitable if your service will use additional threads.
In any case, you can always just use the core module instead, and use the Spring integration implementation classes as inspiration for the required glue code.
Suggestions and PRs to extend this module to support more use cases are of course always welcome!
- You usually don't have to interact with
RhymeBuilder
to configure and create aRhyme
instance yourself - Instead, you can use
@Autowire
to inject a request-scopedSpringRhyme
bean into your application- this SpringRhyme instance will allow you to fetch remote resources (using a Spring
WebClient
), or modify your response's max-age
- this SpringRhyme instance will allow you to fetch remote resources (using a Spring
- To render a resource, simply return a
LinkableResource
instance (that also implements a@HalApiInterface
) from your@RestController
's request handling method - You can use the
UrlFingerprinting
andRhymeLinkBuilder
interfaces to create fingerprinted links to your controller methods (with the help of Spring HATEOAS'sWebMvcLinkBuilder
) - Any exceptions thrown by your resources (or by the Spring framework) will be caught by Rhyme and rendered as a vnd.error resource
- spring-hypermedia - a well documented example of all the key concepts
- spring-hello-world - a simpler starting point with minimal dependencies
- See the main README for a general introduction to the usage of the Rhyme framework
- See the Javadocs for the Spring integration API at https://caravan.wcm.io/rhyme/spring/apidocs/
- The Javadocs for the core framework can be found at https://caravan.wcm.io/rhyme/core/apidocs/