Add support for Spring HATEOAS hypermedia in Actuator endpoints
If spring-hateoas is on the classpath and an MvcEndpoint returns a @ResponseBody it will be extended and wrapped into a Resource with links. All the existing endpoints that return sensible JSON data can be extended this way (i.e. not /logfile). The HAL browser will also be added as an endpoint if available on the classpath. Finally, asciidocs for the Actuator endpoints are available as a separate jar file, which if included in an app will also generate a new (HTTP) endpoint. Fixes gh-1390
This commit is contained in:
@@ -150,6 +150,28 @@ For example, the following will disable _all_ endpoints except for `info`:
|
||||
endpoints.info.enabled=true
|
||||
----
|
||||
|
||||
[[production-ready-endpoint-hypermedia]]
|
||||
=== Hypermedia for MVC Endpoints
|
||||
If http://projects.spring.io/spring-hateoas[Spring HATEOAS] is on the classpath (e.g.
|
||||
through the `spring-boot-starter-hateoas` or if you are using
|
||||
http://projects.spring.io/spring-data-rest[Spring Data REST]) then the HTTP endpoints
|
||||
from the Actuator are enhanced with hypermedia links, and a "discovery page" is added
|
||||
with links to all the endpoints. The "discovery page" is actually an endpoint itself,
|
||||
so it can be disabled along with the rest of the hypermedia by setting
|
||||
`endpoints.links.enabled=false`. If it is not explicitly disabled the links
|
||||
endpoint renders a JSON object with a link for each other endpoint, and the default
|
||||
path is the same as the `management.contentPath` (so "/" by default).
|
||||
|
||||
NOTE: if there is a static home page ("index.html") in your application and the links
|
||||
endpoint is registered with its default path ("/") then content negotiation will kick in
|
||||
to determine which content is shown to a client that requests the home page (the
|
||||
links will show only if the client accepts `application/json`).
|
||||
|
||||
If the https://github.com/mikekelly/hal-browser[HAL Browser] is on the classpath
|
||||
via its webjar (`org.webjars:hal-browser`), or via the `spring-data-hal-browser` then
|
||||
the default home page for HTML clients will be the HAL Browser. This is also exposed via an
|
||||
endpoint ("hal") so it can be disabled and have its path explicitly configured like
|
||||
the other endpoints.
|
||||
|
||||
|
||||
[[production-ready-customizing-endpoints-programmatically]]
|
||||
|
||||
Reference in New Issue
Block a user