Merge branch '3.3.x' into 3.4.x

Closes gh-45633
This commit is contained in:
Phillip Webb 2025-05-20 14:38:35 -07:00
commit 41be61da15
2 changed files with 47 additions and 1 deletions

View File

@ -66,3 +66,13 @@ The following table describes the structure of the `process` section of the resp
[cols="2,1,3"] [cols="2,1,3"]
include::partial$rest/actuator/info/response-fields-beneath-process.adoc[] 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[]

View File

@ -27,6 +27,7 @@ import org.springframework.boot.actuate.info.BuildInfoContributor;
import org.springframework.boot.actuate.info.GitInfoContributor; import org.springframework.boot.actuate.info.GitInfoContributor;
import org.springframework.boot.actuate.info.InfoContributor; import org.springframework.boot.actuate.info.InfoContributor;
import org.springframework.boot.actuate.info.InfoEndpoint; 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.OsInfoContributor;
import org.springframework.boot.actuate.info.ProcessInfoContributor; import org.springframework.boot.actuate.info.ProcessInfoContributor;
import org.springframework.boot.info.BuildProperties; import org.springframework.boot.info.BuildProperties;
@ -53,7 +54,8 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
@Test @Test
void info() { void info() {
assertThat(this.mvc.get().uri("/actuator/info")).hasStatusOk() 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() { private ResponseFieldsSnippet gitInfo() {
@ -111,6 +113,35 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
.description("The maximum number of bytes that can be used by the JVM (or -1).")); .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) @Configuration(proxyBeanMethods = false)
static class TestConfiguration { static class TestConfiguration {
@ -150,6 +181,11 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
return new ProcessInfoContributor(); return new ProcessInfoContributor();
} }
@Bean
JavaInfoContributor javaInfoContributor() {
return new JavaInfoContributor();
}
} }
} }