Polish Actuator hypermedia support

This commit is contained in:
Phillip Webb
2015-07-05 20:06:44 -07:00
parent 67dd164dc3
commit e8085016ba
67 changed files with 1140 additions and 905 deletions

View File

@@ -150,30 +150,33 @@ 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
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
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).
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
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 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]]
=== Adding Custom Endpoints
If you add a `@Bean` of type `Endpoint` then it will automatically be exposed over JMX and