Skip to content

Commit f35d6b6

Browse files
committed
Migrate actuator-autoconfigure to Antora
See gh-33766
1 parent 8d64e99 commit f35d6b6

31 files changed

+400
-314
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle

+33-50
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
id "java-library"
3-
id "org.asciidoctor.jvm.convert"
3+
id "org.antora"
44
id "org.springframework.boot.auto-configuration"
55
id "org.springframework.boot.configuration-properties"
66
id "org.springframework.boot.conventions"
@@ -11,13 +11,10 @@ plugins {
1111
description = "Spring Boot Actuator AutoConfigure"
1212

1313
configurations {
14-
documentation
14+
antoraContent
1515
}
1616

1717
dependencies {
18-
asciidoctorExtensions("org.springframework.restdocs:spring-restdocs-asciidoctor")
19-
asciidoctorExtensions("io.spring.asciidoctor:spring-asciidoctor-extensions-section-ids")
20-
2118
api(project(":spring-boot-project:spring-boot-actuator"))
2219
api(project(":spring-boot-project:spring-boot"))
2320
api(project(":spring-boot-project:spring-boot-autoconfigure"))
@@ -195,38 +192,6 @@ dependencies {
195192
}
196193
}
197194

198-
task dependencyVersions(type: org.springframework.boot.build.constraints.ExtractVersionConstraints) {
199-
enforcedPlatform(":spring-boot-project:spring-boot-dependencies")
200-
}
201-
202-
asciidoctor {
203-
sources {
204-
include "index.adoc"
205-
}
206-
}
207-
208-
task asciidoctorPdf(type: org.asciidoctor.gradle.jvm.AsciidoctorTask) {
209-
sources {
210-
include "index.adoc"
211-
}
212-
}
213-
214-
task zip(type: Zip) {
215-
dependsOn asciidoctor, asciidoctorPdf
216-
duplicatesStrategy "fail"
217-
from(asciidoctorPdf.outputDir) {
218-
into "pdf"
219-
rename { "spring-boot-actuator-web-api.pdf" }
220-
}
221-
from(asciidoctor.outputDir) {
222-
into "htmlsingle"
223-
}
224-
}
225-
226-
artifacts {
227-
documentation zip
228-
}
229-
230195
tasks.named("test") {
231196
jvmArgs += "--add-opens=java.base/java.net=ALL-UNNAMED"
232197
filter {
@@ -235,28 +200,46 @@ tasks.named("test") {
235200
}
236201

237202
def documentationTest = tasks.register("documentationTest", Test) {
203+
jvmArgs += "--add-opens=java.base/java.net=ALL-UNNAMED"
238204
filter {
239205
includeTestsMatching("org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation.*")
240206
}
241-
jvmArgs += "--add-opens=java.base/java.net=ALL-UNNAMED"
242207
outputs.dir("${buildDir}/generated-snippets")
243208
predictiveSelection {
244209
enabled = false
245210
}
246211
}
247212

248-
tasks.withType(org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask) {
249-
dependsOn dependencyVersions
250-
doFirst {
251-
def versionConstraints = dependencyVersions.versionConstraints
252-
def toAntoraVersion = version -> {
253-
String formatted = version.split("\\.").take(2).join('.')
254-
return version.endsWith("-SNAPSHOT") ? formatted + "-SNAPSHOT" : formatted
255-
}
256-
def integrationVersion = versionConstraints["org.springframework.integration:spring-integration-core"]
257-
String integrationDocs = String.format("https://docs.spring.io/spring-integration/reference/%s", toAntoraVersion(integrationVersion))
258-
attributes "spring-integration-docs": integrationDocs
213+
def antoraActuatorRestApiLocalAggregateContent = tasks.register("antoraActuatorRestApiLocalAggregateContent", Zip) {
214+
destinationDirectory = layout.buildDirectory.dir('generated/docs/antora-content')
215+
archiveClassifier = "actuator-rest-api-local-aggregate-content"
216+
from(tasks.getByName("generateAntoraYml")) {
217+
into "modules"
259218
}
219+
}
220+
221+
def antoraActuatorRestApiAggregateContent = tasks.register("antoraActuatorRestApiAggregateContent", Zip) {
260222
dependsOn documentationTest
261-
inputs.dir("${buildDir}/generated-snippets").withPathSensitivity(PathSensitivity.RELATIVE).withPropertyName("generatedSnippets")
223+
inputs.dir("${buildDir}/generated-snippets")
224+
.withPathSensitivity(PathSensitivity.RELATIVE)
225+
.withPropertyName("generatedSnippets")
226+
destinationDirectory = layout.buildDirectory.dir('generated/docs/antora-content')
227+
archiveClassifier = "actuator-rest-api-aggregate-content"
228+
from("${buildDir}/generated-snippets") {
229+
into "modules/api/partials/rest/actuator"
230+
}
231+
}
232+
233+
tasks.named("generateAntoraPlaybook") {
234+
alwaysInclude = [name: "actuator-rest-api", classifier: "local-aggregate-content"]
235+
dependsOn antoraActuatorRestApiLocalAggregateContent
236+
}
237+
238+
tasks.named("antora") {
239+
inputs.files(antoraActuatorRestApiAggregateContent)
262240
}
241+
242+
artifacts {
243+
antoraContent antoraActuatorRestApiAggregateContent
244+
}
245+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name: spring-boot
2+
ext:
3+
zip_contents_collector:
4+
include:
5+
- name: actuator-rest-api
6+
classifier: aggregate-content
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include::api:partial$nav-actuator-rest-api.adoc[]
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,40 @@
11
[[audit-events]]
22
= Audit Events (`auditevents`)
3+
34
The `auditevents` endpoint provides information about the application's audit events.
45

56

67

78
[[audit-events.retrieving]]
89
== Retrieving Audit Events
10+
911
To retrieve the audit events, make a `GET` request to `/actuator/auditevents`, as shown in the following curl-based example:
1012

11-
include::{snippets}/auditevents/filtered/curl-request.adoc[]
13+
include::partial$rest/actuator/auditevents/filtered/curl-request.adoc[]
1214

1315
The preceding example retrieves `logout` events for the principal, `alice`, that occurred after 09:37 on 7 November 2017 in the UTC timezone.
1416
The resulting response is similar to the following:
1517

16-
include::{snippets}/auditevents/filtered/http-response.adoc[]
18+
include::partial$rest/actuator/auditevents/filtered/http-response.adoc[]
1719

1820

1921

2022
[[audit-events.retrieving.query-parameters]]
2123
=== Query Parameters
24+
2225
The endpoint uses query parameters to limit the events that it returns.
2326
The following table shows the supported query parameters:
2427

2528
[cols="2,4"]
26-
include::{snippets}/auditevents/filtered/query-parameters.adoc[]
29+
include::partial$rest/actuator/auditevents/filtered/query-parameters.adoc[]
2730

2831

2932

3033
[[audit-events.retrieving.response-structure]]
3134
=== Response Structure
35+
3236
The response contains details of all of the audit events that matched the query.
3337
The following table describes the structure of the response:
3438

3539
[cols="2,1,3"]
36-
include::{snippets}/auditevents/all/response-fields.adoc[]
40+
include::partial$rest/actuator/auditevents/all/response-fields.adoc[]
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
[[beans]]
22
= Beans (`beans`)
3+
34
The `beans` endpoint provides information about the application's beans.
45

56

67

78
[[beans.retrieving]]
89
== Retrieving the Beans
10+
911
To retrieve the beans, make a `GET` request to `/actuator/beans`, as shown in the following curl-based example:
1012

11-
include::{snippets}/beans/curl-request.adoc[]
13+
include::partial$rest/actuator/beans/curl-request.adoc[]
1214

1315
The resulting response is similar to the following:
1416

15-
include::{snippets}/beans/http-response.adoc[]
17+
include::partial$rest/actuator/beans/http-response.adoc[]
1618

1719

1820

1921
[[beans.retrieving.response-structure]]
2022
=== Response Structure
23+
2124
The response contains details of the application's beans.
2225
The following table describes the structure of the response:
2326

2427
[cols="2,1,3"]
25-
include::{snippets}/beans/response-fields.adoc[]
28+
include::partial$rest/actuator/beans/response-fields.adoc[]
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,97 @@
11
[[caches]]
22
= Caches (`caches`)
3+
34
The `caches` endpoint provides access to the application's caches.
45

56

67

78
[[caches.all]]
89
== Retrieving All Caches
10+
911
To retrieve the application's caches, make a `GET` request to `/actuator/caches`, as shown in the following curl-based example:
1012

11-
include::{snippets}/caches/all/curl-request.adoc[]
13+
include::partial$rest/actuator/caches/all/curl-request.adoc[]
1214

1315
The resulting response is similar to the following:
1416

15-
include::{snippets}/caches/all/http-response.adoc[]
17+
include::partial$rest/actuator/caches/all/http-response.adoc[]
1618

1719

1820

1921
[[caches.all.response-structure]]
2022
=== Response Structure
23+
2124
The response contains details of the application's caches.
2225
The following table describes the structure of the response:
2326

2427
[cols="3,1,3"]
25-
include::{snippets}/caches/all/response-fields.adoc[]
28+
include::partial$rest/actuator/caches/all/response-fields.adoc[]
2629

2730

2831

2932
[[caches.named]]
3033
== Retrieving Caches by Name
34+
3135
To retrieve a cache by name, make a `GET` request to `/actuator/caches/\{name}`, as shown in the following curl-based example:
3236

33-
include::{snippets}/caches/named/curl-request.adoc[]
37+
include::partial$rest/actuator/caches/named/curl-request.adoc[]
3438

3539
The preceding example retrieves information about the cache named `cities`.
3640
The resulting response is similar to the following:
3741

38-
include::{snippets}/caches/named/http-response.adoc[]
42+
include::partial$rest/actuator/caches/named/http-response.adoc[]
3943

4044

4145

4246
[[caches.named.query-parameters]]
4347
=== Query Parameters
48+
4449
If the requested name is specific enough to identify a single cache, no extra parameter is required.
4550
Otherwise, the `cacheManager` must be specified.
4651
The following table shows the supported query parameters:
4752

4853
[cols="2,4"]
49-
include::{snippets}/caches/named/query-parameters.adoc[]
54+
include::partial$rest/actuator/caches/named/query-parameters.adoc[]
5055

5156

5257

5358
[[caches.named.response-structure]]
5459
=== Response Structure
60+
5561
The response contains details of the requested cache.
5662
The following table describes the structure of the response:
5763

5864
[cols="3,1,3"]
59-
include::{snippets}/caches/named/response-fields.adoc[]
65+
include::partial$rest/actuator/caches/named/response-fields.adoc[]
6066

6167

6268

6369
[[caches.evict-all]]
6470
== Evict All Caches
71+
6572
To clear all available caches, make a `DELETE` request to `/actuator/caches` as shown in the following curl-based example:
6673

67-
include::{snippets}/caches/evict-all/curl-request.adoc[]
74+
include::partial$rest/actuator/caches/evict-all/curl-request.adoc[]
6875

6976

7077

7178
[[caches.evict-named]]
7279
== Evict a Cache by Name
80+
7381
To evict a particular cache, make a `DELETE` request to `/actuator/caches/\{name}` as shown in the following curl-based example:
7482

75-
include::{snippets}/caches/evict-named/curl-request.adoc[]
83+
include::partial$rest/actuator/caches/evict-named/curl-request.adoc[]
7684

7785
NOTE: As there are two caches named `countries`, the `cacheManager` has to be provided to specify which `Cache` should be cleared.
7886

7987

8088

8189
[[caches.evict-named.request-structure]]
8290
=== Request Structure
91+
8392
If the requested name is specific enough to identify a single cache, no extra parameter is required.
8493
Otherwise, the `cacheManager` must be specified.
8594
The following table shows the supported query parameters:
8695

8796
[cols="2,4"]
88-
include::{snippets}/caches/evict-named/query-parameters.adoc[]
97+
include::partial$rest/actuator/caches/evict-named/query-parameters.adoc[]
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
[[conditions]]
22
= Conditions Evaluation Report (`conditions`)
3+
34
The `conditions` endpoint provides information about the evaluation of conditions on configuration and auto-configuration classes.
45

56

67

78
[[conditions.retrieving]]
89
== Retrieving the Report
10+
911
To retrieve the report, make a `GET` request to `/actuator/conditions`, as shown in the following curl-based example:
1012

11-
include::{snippets}/conditions/curl-request.adoc[]
13+
include::partial$rest/actuator/conditions/curl-request.adoc[]
1214

1315
The resulting response is similar to the following:
1416

15-
include::{snippets}/conditions/http-response.adoc[]
17+
include::partial$rest/actuator/conditions/http-response.adoc[]
1618

1719

1820

1921
[[conditions.retrieving.response-structure]]
2022
=== Response Structure
23+
2124
The response contains details of the application's condition evaluation.
2225
The following table describes the structure of the response:
2326

2427
[cols="3,1,3"]
25-
include::{snippets}/conditions/response-fields.adoc[]
28+
include::partial$rest/actuator/conditions/response-fields.adoc[]

0 commit comments

Comments
 (0)