Skip to content

Commit a6f1619

Browse files
committed
Use Asciidoctor extension to verify documented configuration properties
Closes spring-projectsgh-18451
1 parent a36d2cd commit a6f1619

File tree

8 files changed

+351
-321
lines changed

8 files changed

+351
-321
lines changed

spring-boot-project/spring-boot-docs/pom.xml

+32-3
Original file line numberDiff line numberDiff line change
@@ -1522,8 +1522,31 @@
15221522
<spring-framework-version>${spring-framework.version}</spring-framework-version>
15231523
<spring-integration-version>${spring-integration.version}</spring-integration-version>
15241524
<spring-security-version>${spring-security.version}</spring-security-version>
1525-
<spring-webservices-version>${spring-ws.version}</spring-webservices-version> </attributes>
1525+
<spring-webservices-version>${spring-ws.version}</spring-webservices-version>
1526+
</attributes>
15261527
</configuration>
1528+
<dependencies>
1529+
<dependency>
1530+
<groupId>io.spring.asciidoctor</groupId>
1531+
<artifactId>spring-asciidoctor-extensions-spring-boot</artifactId>
1532+
<version>${spring-asciidoctor-extensions.version}</version>
1533+
</dependency>
1534+
<dependency>
1535+
<groupId>org.springframework.boot</groupId>
1536+
<artifactId>spring-boot-actuator-autoconfigure</artifactId>
1537+
<version>${revision}</version>
1538+
</dependency>
1539+
<dependency>
1540+
<groupId>org.springframework.boot</groupId>
1541+
<artifactId>spring-boot-autoconfigure</artifactId>
1542+
<version>${revision}</version>
1543+
</dependency>
1544+
<dependency>
1545+
<groupId>org.springframework.boot</groupId>
1546+
<artifactId>spring-boot-devtools</artifactId>
1547+
<version>${revision}</version>
1548+
</dependency>
1549+
</dependencies>
15271550
<executions>
15281551
<execution>
15291552
<id>generate-html-documentation</id>
@@ -1551,9 +1574,9 @@
15511574
<attribute-missing>warn</attribute-missing>
15521575
</attributes>
15531576
<logHandler>
1554-
<outputToConsole>true</outputToConsole>
1577+
<outputToConsole>false</outputToConsole>
15551578
<failIf>
1556-
<severity>DEBUG</severity>
1579+
<severity>INFO</severity>
15571580
</failIf>
15581581
</logHandler>
15591582
</configuration>
@@ -1581,6 +1604,12 @@
15811604
<stylesdir>css/</stylesdir>
15821605
<stylesheet>spring.css</stylesheet>
15831606
</attributes>
1607+
<logHandler>
1608+
<outputToConsole>false</outputToConsole>
1609+
<failIf>
1610+
<severity>INFO</severity>
1611+
</failIf>
1612+
</logHandler>
15841613
</configuration>
15851614
</execution>
15861615
<execution>

spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-configuration-metadata.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ They use a simple JSON format with items categorized under either "`groups`" or
8181
Each "`property`" is a configuration item that the user specifies with a given value.
8282
For example, `server.port` and `server.address` might be specified in `application.properties`, as follows:
8383

84-
[source,properties,indent=0]
84+
[source,properties,indent=0,configprops]
8585
----
8686
server.port=9090
8787
server.address=127.0.0.1
@@ -94,7 +94,7 @@ NOTE: It is not required that every "`property`" has a "`group`".
9494
Some properties might exist in their own right.
9595

9696
Finally, "`hints`" are additional information used to assist the user in configuring a given property.
97-
For example, when a developer is configuring the `spring.jpa.hibernate.ddl-auto` property, a tool can use the hints to offer some auto-completion help for the `none`, `validate`, `update`, `create`, and `create-drop` values.
97+
For example, when a developer is configuring the configprop:spring.jpa.hibernate.ddl-auto[] property, a tool can use the hints to offer some auto-completion help for the `none`, `validate`, `update`, `create`, and `create-drop` values.
9898

9999

100100

spring-boot-project/spring-boot-docs/src/main/asciidoc/howto.adoc

+37-37
Large diffs are not rendered by default.

spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc

+90-90
Large diffs are not rendered by default.

spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc

+166-166
Large diffs are not rendered by default.

spring-boot-project/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc

+20-20
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ If you find that specific auto-configuration classes that you do not want are be
410410
----
411411

412412
If the class is not on the classpath, you can use the `excludeName` attribute of the annotation and specify the fully qualified name instead.
413-
Finally, you can also control the list of auto-configuration classes to exclude by using the `spring.autoconfigure.exclude` property.
413+
Finally, you can also control the list of auto-configuration classes to exclude by using the configprop:spring.autoconfigure.exclude[] property.
414414

415415
TIP: You can define exclusions both at the annotation level and by using the property.
416416

@@ -685,14 +685,14 @@ While caching is very beneficial in production, it can be counter-productive dur
685685
For this reason, spring-boot-devtools disables the caching options by default.
686686

687687
Cache options are usually configured by settings in your `application.properties` file.
688-
For example, Thymeleaf offers the `spring.thymeleaf.cache` property.
688+
For example, Thymeleaf offers the configprop:spring.thymeleaf.cache[] property.
689689
Rather than needing to set these properties manually, the `spring-boot-devtools` module automatically applies sensible development-time configuration.
690690

691691
Because you need more information about web requests while developing Spring MVC and Spring WebFlux applications, developer tools will enable `DEBUG` logging for the `web` logging group.
692692
This will give you information about the incoming request, which handler is processing it, the response outcome, etc.
693-
If you wish to log all request details (including potentially sensitive information), you can turn on the `spring.http.log-request-details` configuration property.
693+
If you wish to log all request details (including potentially sensitive information), you can turn on the configprop:spring.http.log-request-details[] configuration property.
694694

695-
NOTE: If you don't want property defaults to be applied you can set `spring.devtools.add-properties` to `false` in your `application.properties`.
695+
NOTE: If you don't want property defaults to be applied you can set configprop:spring.devtools.add-properties[] to `false` in your `application.properties`.
696696

697697
TIP: For a complete list of the properties that are applied by the devtools, see {spring-boot-devtools-module-code}/env/DevToolsPropertyDefaultsPostProcessor.java[DevToolsPropertyDefaultsPostProcessor].
698698

@@ -763,32 +763,32 @@ To disable the logging of the report, set the following property:
763763
Certain resources do not necessarily need to trigger a restart when they are changed.
764764
For example, Thymeleaf templates can be edited in-place.
765765
By default, changing resources in `/META-INF/maven`, `/META-INF/resources`, `/resources`, `/static`, `/public`, or `/templates` does not trigger a restart but does trigger a <<using-boot-devtools-livereload, live reload>>.
766-
If you want to customize these exclusions, you can use the `spring.devtools.restart.exclude` property.
766+
If you want to customize these exclusions, you can use the configprop:spring.devtools.restart.exclude[] property.
767767
For example, to exclude only `/static` and `/public` you would set the following property:
768768

769769
[indent=0]
770770
----
771771
spring.devtools.restart.exclude=static/**,public/**
772772
----
773773

774-
TIP: If you want to keep those defaults and _add_ additional exclusions, use the `spring.devtools.restart.additional-exclude` property instead.
774+
TIP: If you want to keep those defaults and _add_ additional exclusions, use the configprop:spring.devtools.restart.additional-exclude[] property instead.
775775

776776

777777

778778
[[using-boot-devtools-restart-additional-paths]]
779779
==== Watching Additional Paths
780780
You may want your application to be restarted or reloaded when you make changes to files that are not on the classpath.
781-
To do so, use the `spring.devtools.restart.additional-paths` property to configure additional paths to watch for changes.
782-
You can use the `spring.devtools.restart.exclude` property <<using-boot-devtools-restart-exclude, described earlier>> to control whether changes beneath the additional paths trigger a full restart or a <<using-boot-devtools-livereload, live reload>>.
781+
To do so, use the configprop:spring.devtools.restart.additional-paths[] property to configure additional paths to watch for changes.
782+
You can use the configprop:spring.devtools.restart.exclude[] property <<using-boot-devtools-restart-exclude, described earlier>> to control whether changes beneath the additional paths trigger a full restart or a <<using-boot-devtools-livereload, live reload>>.
783783

784784

785785

786786
[[using-boot-devtools-restart-disable]]
787787
==== Disabling Restart
788-
If you do not want to use the restart feature, you can disable it by using the `spring.devtools.restart.enabled` property.
788+
If you do not want to use the restart feature, you can disable it by using the configprop:spring.devtools.restart.enabled[] property.
789789
In most cases, you can set this property in your `application.properties` (doing so still initializes the restart classloader, but it does not watch for file changes).
790790

791-
If you need to _completely_ disable restart support (for example, because it does not work with a specific library), you need to set the `spring.devtools.restart.enabled` `System` property to `false` before calling `SpringApplication.run(...)`, as shown in the following example:
791+
If you need to _completely_ disable restart support (for example, because it does not work with a specific library), you need to set the configprop:spring.devtools.restart.enabled[] `System` property to `false` before calling `SpringApplication.run(...)`, as shown in the following example:
792792

793793
[source,java,indent=0]
794794
----
@@ -807,7 +807,7 @@ To do so, you can use a "`trigger file`", which is a special file that must be m
807807

808808
NOTE: Any update to the file will trigger a check, but restart only actually occurs if Devtools has detected it has something to do.
809809

810-
To use a trigger file, set the `spring.devtools.restart.trigger-file` property to the name (excluding any path) of your trigger file.
810+
To use a trigger file, set the configprop:spring.devtools.restart.trigger-file[] property to the name (excluding any path) of your trigger file.
811811
The trigger file must appear somewhere on your classpath.
812812

813813
For example, if you have a project with the following structure:
@@ -822,7 +822,7 @@ For example, if you have a project with the following structure:
822822

823823
Then your `trigger-file` property would be:
824824

825-
[source,properties,indent=0]
825+
[source,properties,indent=0,configprops]
826826
----
827827
spring.devtools.restart.trigger-file=.reloadtrigger
828828
----
@@ -881,7 +881,7 @@ If you find such a problem, you need to request a fix with the original authors.
881881
The `spring-boot-devtools` module includes an embedded LiveReload server that can be used to trigger a browser refresh when a resource is changed.
882882
LiveReload browser extensions are freely available for Chrome, Firefox and Safari from http://livereload.com/extensions/[livereload.com].
883883

884-
If you do not want to start the LiveReload server when your application runs, you can set the `spring.devtools.livereload.enabled` property to `false`.
884+
If you do not want to start the LiveReload server when your application runs, you can set the configprop:spring.devtools.livereload.enabled[] property to `false`.
885885

886886
NOTE: You can only run one LiveReload server at a time.
887887
Before starting your application, ensure that no other LiveReload servers are running.
@@ -901,9 +901,9 @@ Any properties added to these file apply to _all_ Spring Boot applications on yo
901901
For example, to configure restart to always use a <<using-boot-devtools-restart-triggerfile, trigger file>>, you would add the following property:
902902

903903
.~/config/spring-boot/spring-boot-devtools.properties
904-
[source,properties,indent=0]
904+
[source,properties,indent=0,configprops]
905905
----
906-
spring.devtools.reload.trigger-file=.reloadtrigger
906+
spring.devtools.restart.trigger-file=.reloadtrigger
907907
----
908908

909909
NOTE: If devtools configuration files are not found in `$HOME/.config/spring-boot`, the root of the `$HOME` folder is searched for the presence of a `.spring-boot-devtools.properties` file.
@@ -935,9 +935,9 @@ To enable it, you need to make sure that `devtools` is included in the repackage
935935
</build>
936936
----
937937

938-
Then you need to set a `spring.devtools.remote.secret` property, as shown in the following example:
938+
Then you need to set a configprop:spring.devtools.remote.secret[] property, as shown in the following example:
939939

940-
[source,properties,indent=0]
940+
[source,properties,indent=0,configprops]
941941
----
942942
spring.devtools.remote.secret=mysecret
943943
----
@@ -946,7 +946,7 @@ WARNING: Enabling `spring-boot-devtools` on a remote application is a security r
946946
You should never enable support on a production deployment.
947947

948948
Remote devtools support is provided in two parts: a server-side endpoint that accepts connections and a client application that you run in your IDE.
949-
The server component is automatically enabled when the `spring.devtools.remote.secret` property is set.
949+
The server component is automatically enabled when the configprop:spring.devtools.remote.secret[] property is set.
950950
The client component must be launched manually.
951951

952952

@@ -984,7 +984,7 @@ A running remote client might resemble the following listing:
984984
----
985985

986986
NOTE: Because the remote client is using the same classpath as the real application it can directly read application properties.
987-
This is how the `spring.devtools.remote.secret` property is read and passed to the server for authentication.
987+
This is how the configprop:spring.devtools.remote.secret[] property is read and passed to the server for authentication.
988988

989989
TIP: It is always advisable to use `https://` as the connection protocol, so that traffic is encrypted and passwords cannot be intercepted.
990990

@@ -1017,7 +1017,7 @@ But it may also lead to application code inconsistency and failure to restart af
10171017

10181018
If you observe such problems constantly, try increasing the `spring.devtools.restart.poll-interval` and `spring.devtools.restart.quiet-period` parameters to the values that fit your development environment:
10191019

1020-
[source,properties,indent=0]
1020+
[source,properties,indent=0,configprops]
10211021
----
10221022
spring.devtools.restart.poll-interval=2s
10231023
spring.devtools.restart.quiet-period=1s

spring-boot-project/spring-boot-parent/pom.xml

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@
2626
<maven.version>3.5.4</maven.version>
2727
<maven-resolver.version>1.1.1</maven-resolver.version>
2828
<spock.version>1.0-groovy-2.4</spock.version>
29-
<testcontainers.version>1.12.2</testcontainers.version>
30-
<testng.version>6.14.3</testng.version>
29+
<spring-asciidoctor-extensions.version>0.3.0.BUILD-SNAPSHOT</spring-asciidoctor-extensions.version>
3130
<spring-doc-resources.version>0.1.3.RELEASE</spring-doc-resources.version>
3231
<spring-doc-resources.url>https://repo.spring.io/release/io/spring/docresources/spring-doc-resources/${spring-doc-resources.version}/spring-doc-resources-${spring-doc-resources.version}.zip</spring-doc-resources.url>
32+
<testcontainers.version>1.12.2</testcontainers.version>
33+
<testng.version>6.14.3</testng.version>
3334
</properties>
3435
<scm>
3536
<url>https://github.com/spring-projects/spring-boot</url>

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@
360360
<dependency>
361361
<groupId>io.spring.asciidoctor</groupId>
362362
<artifactId>spring-asciidoctor-extensions</artifactId>
363-
<version>0.2.0.RELEASE</version>
363+
<version>${spring-asciidoctor-extensions.version}</version>
364364
</dependency>
365365
</dependencies>
366366
</plugin>

0 commit comments

Comments
 (0)