Browse Source

Merge branch '3.4.x'

Closes gh-45634
pull/45635/head
Phillip Webb 9 months ago
parent
commit
df2d0ec420
  1. 10
      spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora/modules/api/pages/rest/actuator/info.adoc
  2. 38
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/info/InfoEndpointDocumentationTests.java

10
spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora/modules/api/pages/rest/actuator/info.adoc

@ -66,3 +66,13 @@ The following table describes the structure of the `process` section of the resp @@ -66,3 +66,13 @@ The following table describes the structure of the `process` section of the resp
[cols="2,1,3"]
include::partial$rest/actuator/info/response-fields-beneath-process.adoc[]
[[info.retrieving.response-structure.java]]
==== Java Response Structure
The following table describes the structure of the `java` section of the response:
[cols="2,1,3"]
include::partial$rest/actuator/info/response-fields-beneath-java.adoc[]

38
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/info/InfoEndpointDocumentationTests.java

@ -27,6 +27,7 @@ import org.springframework.boot.actuate.info.BuildInfoContributor; @@ -27,6 +27,7 @@ import org.springframework.boot.actuate.info.BuildInfoContributor;
import org.springframework.boot.actuate.info.GitInfoContributor;
import org.springframework.boot.actuate.info.InfoContributor;
import org.springframework.boot.actuate.info.InfoEndpoint;
import org.springframework.boot.actuate.info.JavaInfoContributor;
import org.springframework.boot.actuate.info.OsInfoContributor;
import org.springframework.boot.actuate.info.ProcessInfoContributor;
import org.springframework.boot.info.BuildProperties;
@ -53,7 +54,8 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests { @@ -53,7 +54,8 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
@Test
void info() {
assertThat(this.mvc.get().uri("/actuator/info")).hasStatusOk()
.apply(MockMvcRestDocumentation.document("info", gitInfo(), buildInfo(), osInfo(), processInfo()));
.apply(MockMvcRestDocumentation.document("info", gitInfo(), buildInfo(), osInfo(), processInfo(),
javaInfo()));
}
private ResponseFieldsSnippet gitInfo() {
@ -111,6 +113,35 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests { @@ -111,6 +113,35 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
.description("The maximum number of bytes that can be used by the JVM (or -1)."));
}
private ResponseFieldsSnippet javaInfo() {
return responseFields(beneathPath("java"),
fieldWithPath("version").description("Java version, if available.")
.type(JsonFieldType.STRING)
.optional(),
fieldWithPath("vendor").description("Vendor details."),
fieldWithPath("vendor.name").description("Vendor name, if available.")
.type(JsonFieldType.STRING)
.optional(),
fieldWithPath("vendor.version").description("Vendor version, if available.")
.type(JsonFieldType.STRING)
.optional(),
fieldWithPath("runtime").description("Runtime details."),
fieldWithPath("runtime.name").description("Runtime name, if available.")
.type(JsonFieldType.STRING)
.optional(),
fieldWithPath("runtime.version").description("Runtime version, if available.")
.type(JsonFieldType.STRING)
.optional(),
fieldWithPath("jvm").description("JVM details."),
fieldWithPath("jvm.name").description("JVM name, if available.").type(JsonFieldType.STRING).optional(),
fieldWithPath("jvm.vendor").description("JVM vendor, if available.")
.type(JsonFieldType.STRING)
.optional(),
fieldWithPath("jvm.version").description("JVM version, if available.")
.type(JsonFieldType.STRING)
.optional());
}
@Configuration(proxyBeanMethods = false)
static class TestConfiguration {
@ -150,6 +181,11 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests { @@ -150,6 +181,11 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
return new ProcessInfoContributor();
}
@Bean
JavaInfoContributor javaInfoContributor() {
return new JavaInfoContributor();
}
}
}

Loading…
Cancel
Save