Skip to content

Commit 65159f5

Browse files
committed
Merge branch 'main' into 4.0.x
2 parents 04adc73 + df2d0ec commit 65159f5

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,13 @@ The following table describes the structure of the `process` section of the resp
6666

6767
[cols="2,1,3"]
6868
include::partial$rest/actuator/info/response-fields-beneath-process.adoc[]
69+
70+
71+
72+
[[info.retrieving.response-structure.java]]
73+
==== Java Response Structure
74+
75+
The following table describes the structure of the `java` section of the response:
76+
77+
[cols="2,1,3"]
78+
include::partial$rest/actuator/info/response-fields-beneath-java.adoc[]

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

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.springframework.boot.actuate.info.GitInfoContributor;
2828
import org.springframework.boot.actuate.info.InfoContributor;
2929
import org.springframework.boot.actuate.info.InfoEndpoint;
30+
import org.springframework.boot.actuate.info.JavaInfoContributor;
3031
import org.springframework.boot.actuate.info.OsInfoContributor;
3132
import org.springframework.boot.actuate.info.ProcessInfoContributor;
3233
import org.springframework.boot.info.BuildProperties;
@@ -53,7 +54,8 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
5354
@Test
5455
void info() {
5556
assertThat(this.mvc.get().uri("/actuator/info")).hasStatusOk()
56-
.apply(MockMvcRestDocumentation.document("info", gitInfo(), buildInfo(), osInfo(), processInfo()));
57+
.apply(MockMvcRestDocumentation.document("info", gitInfo(), buildInfo(), osInfo(), processInfo(),
58+
javaInfo()));
5759
}
5860

5961
private ResponseFieldsSnippet gitInfo() {
@@ -111,6 +113,35 @@ private ResponseFieldsSnippet processInfo() {
111113
.description("The maximum number of bytes that can be used by the JVM (or -1)."));
112114
}
113115

116+
private ResponseFieldsSnippet javaInfo() {
117+
return responseFields(beneathPath("java"),
118+
fieldWithPath("version").description("Java version, if available.")
119+
.type(JsonFieldType.STRING)
120+
.optional(),
121+
fieldWithPath("vendor").description("Vendor details."),
122+
fieldWithPath("vendor.name").description("Vendor name, if available.")
123+
.type(JsonFieldType.STRING)
124+
.optional(),
125+
fieldWithPath("vendor.version").description("Vendor version, if available.")
126+
.type(JsonFieldType.STRING)
127+
.optional(),
128+
fieldWithPath("runtime").description("Runtime details."),
129+
fieldWithPath("runtime.name").description("Runtime name, if available.")
130+
.type(JsonFieldType.STRING)
131+
.optional(),
132+
fieldWithPath("runtime.version").description("Runtime version, if available.")
133+
.type(JsonFieldType.STRING)
134+
.optional(),
135+
fieldWithPath("jvm").description("JVM details."),
136+
fieldWithPath("jvm.name").description("JVM name, if available.").type(JsonFieldType.STRING).optional(),
137+
fieldWithPath("jvm.vendor").description("JVM vendor, if available.")
138+
.type(JsonFieldType.STRING)
139+
.optional(),
140+
fieldWithPath("jvm.version").description("JVM version, if available.")
141+
.type(JsonFieldType.STRING)
142+
.optional());
143+
}
144+
114145
@Configuration(proxyBeanMethods = false)
115146
static class TestConfiguration {
116147

@@ -150,6 +181,11 @@ ProcessInfoContributor processInfoContributor() {
150181
return new ProcessInfoContributor();
151182
}
152183

184+
@Bean
185+
JavaInfoContributor javaInfoContributor() {
186+
return new JavaInfoContributor();
187+
}
188+
153189
}
154190

155191
}

0 commit comments

Comments
 (0)