Update documentation on Actuator hypermedia support
Spring Boot Actuator hypermedia support has been disabled by default via
c7c685f, but its documentation wasn't updated.
This commit updates the documentation related to the change.
See gh-7215
This commit is contained in:
committed by
Stephane Nicoll
parent
7f8849c62b
commit
1546cd4072
@@ -58,7 +58,7 @@ 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) then the Actuator endpoint responses are enhanced with
|
||||
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
|
||||
|
||||
@@ -33,12 +33,13 @@ import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = SpringBootHypermediaApplication.class, loader = SpringBootContextLoader.class)
|
||||
@WebAppConfiguration
|
||||
@TestPropertySource(properties = "spring.jackson.serialization.indent_output=true")
|
||||
@TestPropertySource(properties = { "spring.jackson.serialization.indent_output=true", "endpoints.hypermedia.enabled=true" })
|
||||
@DirtiesContext
|
||||
@AutoConfigureMockMvc
|
||||
@AutoConfigureRestDocs("target/generated-snippets")
|
||||
@@ -56,7 +57,9 @@ public class HypermediaEndpointDocumentation {
|
||||
@Test
|
||||
public void metrics() throws Exception {
|
||||
this.mockMvc.perform(get("/metrics").accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk()).andDo(document("metrics/hypermedia"));
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$._links.self.href").value("http://localhost:8080/metrics"))
|
||||
.andDo(document("metrics/hypermedia"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user