Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
6d50e26b
Commit
6d50e26b
authored
Oct 30, 2016
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish contribution
Closes gh-7215
parent
1546cd40
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
12 deletions
+25
-12
pom.xml
spring-boot-actuator-docs/pom.xml
+2
-0
index.adoc
spring-boot-actuator-docs/src/main/asciidoc/index.adoc
+9
-7
HypermediaEndpointDocumentation.java
...t/actuate/hypermedia/HypermediaEndpointDocumentation.java
+4
-2
additional-spring-configuration-metadata.json
...es/META-INF/additional-spring-configuration-metadata.json
+6
-0
appendix-application-properties.adoc
...cs/src/main/asciidoc/appendix-application-properties.adoc
+1
-1
production-ready-features.adoc
...oot-docs/src/main/asciidoc/production-ready-features.adoc
+3
-2
No files found.
spring-boot-actuator-docs/pom.xml
View file @
6d50e26b
...
...
@@ -86,10 +86,12 @@
<dependency>
<groupId>
org.springframework.hateoas
</groupId>
<artifactId>
spring-hateoas
</artifactId>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.plugin
</groupId>
<artifactId>
spring-plugin-core
</artifactId>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.restdocs
</groupId>
...
...
spring-boot-actuator-docs/src/main/asciidoc/index.adoc
View file @
6d50e26b
...
...
@@ -57,13 +57,15 @@ HAL browser is not active).
== Hypermedia Support
If https://projects.spring.io/spring-hateoas[Spring HATEOAS] is enabled (i.e. if it is
on the classpath by default) and `endpoints.hypermedia.enabled` is set to `true` then the Actuator endpoint responses are enhanced with
hypermedia in the form of "links". The default media type for responses is
http://stateless.co/hal_specification.html[HAL], resulting in each resource having an
extra property called "_links". You can change the media type to another one supported by
Spring HATEOAS by providing your own `@EnableHypermedia` annotation and custom providers
as necessary.
If `endpoints.hypermedia.enabled` is set to `true` and
https://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 Actuator endpoint
responses are enhanced with hypermedia in the form of "links". The default media type for
responses is http://stateless.co/hal_specification.html[HAL], resulting in each resource
having an extra property called "_links". You can change the media type to another one
supported by Spring HATEOAS by providing your own `@EnableHypermedia` annotation and
custom providers as necessary.
Example enhanced "/metrics" endpoint with additional "_links":
...
...
spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/HypermediaEndpointDocumentation.java
View file @
6d50e26b
...
...
@@ -39,7 +39,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@RunWith
(
SpringRunner
.
class
)
@ContextConfiguration
(
classes
=
SpringBootHypermediaApplication
.
class
,
loader
=
SpringBootContextLoader
.
class
)
@WebAppConfiguration
@TestPropertySource
(
properties
=
{
"spring.jackson.serialization.indent_output=true"
,
"endpoints.hypermedia.enabled=true"
})
@TestPropertySource
(
properties
=
{
"spring.jackson.serialization.indent_output=true"
,
"endpoints.hypermedia.enabled=true"
})
@DirtiesContext
@AutoConfigureMockMvc
@AutoConfigureRestDocs
(
"target/generated-snippets"
)
...
...
@@ -58,7 +59,8 @@ public class HypermediaEndpointDocumentation {
public
void
metrics
()
throws
Exception
{
this
.
mockMvc
.
perform
(
get
(
"/metrics"
).
accept
(
MediaType
.
APPLICATION_JSON
))
.
andExpect
(
status
().
isOk
())
.
andExpect
(
jsonPath
(
"$._links.self.href"
).
value
(
"http://localhost:8080/metrics"
))
.
andExpect
(
jsonPath
(
"$._links.self.href"
)
.
value
(
"http://localhost:8080/metrics"
))
.
andDo
(
document
(
"metrics/hypermedia"
));
}
...
...
spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json
View file @
6d50e26b
...
...
@@ -47,6 +47,12 @@
"vcap_services"
]
},
{
"name"
:
"endpoints.hypermedia.enabled"
,
"type"
:
"java.lang.Boolean"
,
"description"
:
"Enable hypermedia support for endpoints."
,
"defaultValue"
:
false
},
{
"name"
:
"endpoints.info.path"
,
"type"
:
"java.lang.String"
,
...
...
spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
View file @
6d50e26b
...
...
@@ -930,7 +930,6 @@ content into your application; rather pick only the properties that you need.
# ENDPOINTS ({sc-spring-boot-actuator}/endpoint/AbstractEndpoint.{sc-ext}[AbstractEndpoint] subclasses)
endpoints.enabled=true # Enable endpoints.
endpoints.sensitive= # Default endpoint sensitive setting.
endpoints.hypermedia.enabled=false # Enable hypermedia support for endpoints.
endpoints.actuator.enabled=true # Enable the endpoint.
endpoints.actuator.path= # Endpoint URL path.
endpoints.actuator.sensitive=false # Enable security on the endpoint.
...
...
@@ -972,6 +971,7 @@ content into your application; rather pick only the properties that you need.
endpoints.heapdump.enabled= # Enable the endpoint.
endpoints.heapdump.path= # Endpoint path.
endpoints.heapdump.sensitive= # Mark if the endpoint exposes sensitive information.
endpoints.hypermedia.enabled=false # Enable hypermedia support for endpoints.
endpoints.info.enabled= # Enable the endpoint.
endpoints.info.id= # Endpoint identifier.
endpoints.info.path= # Endpoint path.
...
...
spring-boot-docs/src/main/asciidoc/production-ready-features.adoc
View file @
6d50e26b
...
...
@@ -203,9 +203,10 @@ For example, to mark _all_ endpoints as sensitive except `info`:
[[production-ready-endpoint-hypermedia]]
=== Hypermedia for actuator MVC endpoints
If http://projects.spring.io/spring-hateoas[Spring HATEOAS] is on the classpath (e.g.
If `endpoints.hypermedia.enabled` is set to `true` and
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])
and `endpoints.hypermedia.enabled` is set to `true`
then the HTTP endpoints
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 available on `/actuator` by
default. It is implemented as an endpoint, allowing properties to be used to configure
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment