Skip to content

Commit

Permalink
Merge branch '2.5.x' into 2.6.x
Browse files Browse the repository at this point in the history
Closes gh-29689
  • Loading branch information
wilkinsona committed Feb 9, 2022
2 parents b46eba1 + 43dc378 commit 093e8a5
Show file tree
Hide file tree
Showing 37 changed files with 234 additions and 165 deletions.
Expand Up @@ -90,7 +90,9 @@ private Set<String> writeSnippet(Path outputDirectory, Snippet snippet, Set<Stri

private Asciidoc getAsciidoc(Snippet snippet, Table table) {
Asciidoc asciidoc = new Asciidoc();
asciidoc.appendln("[[" + snippet.getAnchor() + "]]");
// We have to prepend 'appendix.' as a section id here, otherwise the
// spring-asciidoctor-extensions:section-id asciidoctor extension complains
asciidoc.appendln("[[appendix." + snippet.getAnchor() + "]]");
asciidoc.appendln("== ", snippet.getTitle());
table.write(asciidoc);
return asciidoc;
Expand Down

Large diffs are not rendered by default.

@@ -1,5 +1,5 @@
[appendix]
[[application-properties]]
[[appendix.application-properties]]
= Common Application Properties
include::attributes.adoc[]

Expand Down
@@ -1,5 +1,5 @@
[appendix]
[[auto-configuration-classes]]
[[appendix.auto-configuration-classes]]
= Auto-configuration Classes
include::attributes.adoc[]

Expand Down
@@ -1,4 +1,4 @@
[[auto-configuration-classes.actuator]]
[[appendix.auto-configuration-classes.actuator]]
== spring-boot-actuator-autoconfigure
The following auto-configuration classes are from the `spring-boot-actuator-autoconfigure` module:

Expand Down
@@ -1,4 +1,4 @@
[[auto-configuration-classes.core]]
[[appendix.auto-configuration-classes.core]]
== spring-boot-autoconfigure
The following auto-configuration classes are from the `spring-boot-autoconfigure` module:

Expand Down
@@ -1,7 +1,7 @@
[[build-tool-plugins.other-build-systems]]
== Supporting Other Build Systems
If you want to use a build tool other than Maven, Gradle, or Ant, you likely need to develop your own plugin.
Executable jars need to follow a specific format and certain entries need to be written in an uncompressed form (see the "`<<executable-jar#executable-jar, executable jar format>>`" section in the appendix for details).
Executable jars need to follow a specific format and certain entries need to be written in an uncompressed form (see the "`<<executable-jar#appendix.executable-jar, executable jar format>>`" section in the appendix for details).

The Spring Boot Maven and Gradle plugins both make use of `spring-boot-loader-tools` to actually generate jars.
If you need to, you may use this library directly.
Expand Down
@@ -1,6 +1,6 @@
[[build-tool-plugins.whats-next]]
== What to Read Next
If you are interested in how the build tool plugins work, you can look at the {spring-boot-code}/spring-boot-project/spring-boot-tools[`spring-boot-tools`] module on GitHub.
More technical details of the executable jar format are covered in <<executable-jar#executable-jar,the appendix>>.
More technical details of the executable jar format are covered in <<executable-jar#appendix.executable-jar,the appendix>>.

If you have specific build-related questions, see the "`<<howto#howto, how-to>>`" guides.
Expand Up @@ -146,7 +146,7 @@ Doing so consults Spring Boot's default dependency metadata to deduce the artifa

NOTE: The default metadata is tied to the version of the CLI that you use.
It changes only when you move to a new version of the CLI, putting you in control of when the versions of your dependencies may change.
A table showing the dependencies and their versions that are included in the default metadata can be found in the <<dependency-versions#dependency-versions,appendix>>.
A table showing the dependencies and their versions that are included in the default metadata can be found in the <<dependency-versions#appendix.dependency-versions,appendix>>.



Expand Down
@@ -1,5 +1,5 @@
[appendix]
[[configuration-metadata]]
[[appendix.configuration-metadata]]
= Configuration Metadata
include::attributes.adoc[]

Expand All @@ -9,7 +9,7 @@ Spring Boot jars include metadata files that provide details of all supported co
The files are designed to let IDE developers offer contextual help and "`code completion`" as users are working with `application.properties` or `application.yml` files.

The majority of the metadata file is generated automatically at compile time by processing all items annotated with `@ConfigurationProperties`.
However, it is possible to <<configuration-metadata#configuration-metadata.annotation-processor.adding-additional-metadata,write part of the metadata manually>> for corner cases or more advanced use cases.
However, it is possible to <<configuration-metadata#appendix.configuration-metadata.annotation-processor.adding-additional-metadata,write part of the metadata manually>> for corner cases or more advanced use cases.



Expand Down
@@ -1,11 +1,11 @@
[[configuration-metadata.annotation-processor]]
[[appendix.configuration-metadata.annotation-processor]]
== Generating Your Own Metadata by Using the Annotation Processor
You can easily generate your own configuration metadata file from items annotated with `@ConfigurationProperties` by using the `spring-boot-configuration-processor` jar.
The jar includes a Java annotation processor which is invoked as your project is compiled.



[[configuration-metadata.annotation-processor.configuring]]
[[appendix.configuration-metadata.annotation-processor.configuring]]
=== Configuring the Annotation Processor
To use the processor, include a dependency on `spring-boot-configuration-processor`.

Expand Down Expand Up @@ -59,7 +59,7 @@ You could also let the AspectJ plugin run all the processing and disable annotat



[[configuration-metadata.annotation-processor.automatic-metadata-generation]]
[[appendix.configuration-metadata.annotation-processor.automatic-metadata-generation]]
=== Automatic Metadata Generation
The processor picks up both classes and methods that are annotated with `@ConfigurationProperties`.

Expand All @@ -83,15 +83,15 @@ The annotation processor applies a number of heuristics to extract the default v
Default values have to be provided statically. In particular, do not refer to a constant defined in another class.
Also, the annotation processor cannot auto-detect default values for ``Enum``s and ``Collections``s.

For cases where the default value could not be detected, <<configuration-metadata#configuration-metadata.annotation-processor.adding-additional-metadata,manual metadata>> should be provided.
For cases where the default value could not be detected, <<configuration-metadata#appendix.configuration-metadata.annotation-processor.adding-additional-metadata,manual metadata>> should be provided.
Consider the following example:

[source,java,indent=0,subs="verbatim"]
----
include::{docs-java}/configurationmetadata/annotationprocessor/automaticmetadatageneration/MyMessagingProperties.java[]
----

In order to document default values for properties in the class above, you could add the following content to <<configuration-metadata#configuration-metadata.annotation-processor.adding-additional-metadata,the manual metadata of the module>>:
In order to document default values for properties in the class above, you could add the following content to <<configuration-metadata#appendix.configuration-metadata.annotation-processor.adding-additional-metadata,the manual metadata of the module>>:

[source,json,indent=0,subs="verbatim"]
----
Expand All @@ -111,7 +111,7 @@ NOTE: Only the `name` of the property is required to document additional metadat



[[configuration-metadata.annotation-processor.automatic-metadata-generation.nested-properties]]
[[appendix.configuration-metadata.annotation-processor.automatic-metadata-generation.nested-properties]]
==== Nested Properties
The annotation processor automatically considers inner classes as nested properties.
Rather than documenting the `ip` and `port` at the root of the namespace, we could create a sub-namespace for it.
Expand All @@ -129,7 +129,7 @@ TIP: This has no effect on collections and maps, as those types are automaticall



[[configuration-metadata.annotation-processor.adding-additional-metadata]]
[[appendix.configuration-metadata.annotation-processor.adding-additional-metadata]]
=== Adding Additional Metadata
Spring Boot's configuration file handling is quite flexible, and it is often the case that properties may exist that are not bound to a `@ConfigurationProperties` bean.
You may also need to tune some attributes of an existing key.
Expand Down
@@ -1,4 +1,4 @@
[[configuration-metadata.format]]
[[appendix.configuration-metadata.format]]
== Metadata Format
Configuration metadata files are located inside jars under `META-INF/spring-configuration-metadata.json`.
They use a JSON format with items categorized under either "`groups`" or "`properties`" and additional values hints categorized under "hints", as shown in the following example:
Expand Down Expand Up @@ -86,7 +86,7 @@ For example, when a developer is configuring the configprop:spring.jpa.hibernate



[[configuration-metadata.format.group]]
[[appendix.configuration-metadata.format.group]]
=== Group Attributes
The JSON object contained in the `groups` array can contain the attributes shown in the following table:

Expand Down Expand Up @@ -127,7 +127,7 @@ The JSON object contained in the `groups` array can contain the attributes shown



[[configuration-metadata.format.property]]
[[appendix.configuration-metadata.format.property]]
=== Property Attributes
The JSON object contained in the `properties` array can contain the attributes described in the following table:

Expand Down Expand Up @@ -223,7 +223,7 @@ Doing so is particularly useful when a `replacement` is provided.



[[configuration-metadata.format.hints]]
[[appendix.configuration-metadata.format.hints]]
=== Hint Attributes
The JSON object contained in the `hints` array can contain the attributes shown in the following table:

Expand Down Expand Up @@ -286,7 +286,7 @@ The JSON object contained in the `providers` attribute of each `hint` element ca



[[configuration-metadata.format.repeated-items]]
[[appendix.configuration-metadata.format.repeated-items]]
=== Repeated Metadata Items
Objects with the same "`property`" and "`group`" name can appear multiple times within a metadata file.
For example, you could bind two separate classes to the same prefix, with each having potentially overlapping property names.
Expand Down
@@ -1,4 +1,4 @@
[[configuration-metadata.manual-hints]]
[[appendix.configuration-metadata.manual-hints]]
== Providing Manual Hints
To improve the user experience and further assist the user in configuring a given property, you can provide additional metadata that:

Expand All @@ -7,10 +7,10 @@ To improve the user experience and further assist the user in configuring a give



[[configuration-metadata.manual-hints.value-hint]]
[[appendix.configuration-metadata.manual-hints.value-hint]]
=== Value Hint
The `name` attribute of each hint refers to the `name` of a property.
In the <<configuration-metadata#configuration-metadata.format,initial example shown earlier>>, we provide five values for the `spring.jpa.hibernate.ddl-auto` property: `none`, `validate`, `update`, `create`, and `create-drop`.
In the <<configuration-metadata#appendix.configuration-metadata.format,initial example shown earlier>>, we provide five values for the `spring.jpa.hibernate.ddl-auto` property: `none`, `validate`, `update`, `create`, and `create-drop`.
Each value may have a description as well.

If your property is of type `Map`, you can provide hints for both the keys and the values (but not for the map itself).
Expand All @@ -24,7 +24,7 @@ include::{docs-java}/configurationmetadata/manualhints/valuehint/MyProperties.ja
----

The magic values are (in this example) are `sample1` and `sample2`.
In order to offer additional content assistance for the keys, you could add the following JSON to <<configuration-metadata#configuration-metadata.annotation-processor.adding-additional-metadata,the manual metadata of the module>>:
In order to offer additional content assistance for the keys, you could add the following JSON to <<configuration-metadata#appendix.configuration-metadata.annotation-processor.adding-additional-metadata,the manual metadata of the module>>:

[source,json,indent=0,subs="verbatim"]
----
Expand All @@ -48,7 +48,7 @@ If your IDE supports it, this is by far the most effective approach to auto-comp



[[configuration-metadata.manual-hints.value-providers]]
[[appendix.configuration-metadata.manual-hints.value-providers]]
=== Value Providers
Providers are a powerful way to attach semantics to a property.
In this section, we define the official providers that you can use for your own hints.
Expand Down Expand Up @@ -92,7 +92,7 @@ If no provider for a given property is supported, no special content assistance



[[configuration-metadata.manual-hints.value-providers.any]]
[[appendix.configuration-metadata.manual-hints.value-providers.any]]
==== Any
The special **any** provider value permits any additional values to be provided.
Regular value validation based on the property type should be applied if this is supported.
Expand Down Expand Up @@ -127,7 +127,7 @@ Note that, in the preceding example, any other value is also allowed.



[[configuration-metadata.manual-hints.value-providers.class-reference]]
[[appendix.configuration-metadata.manual-hints.value-providers.class-reference]]
==== Class Reference
The **class-reference** provider auto-completes classes available in the project.
This provider supports the following parameters:
Expand Down Expand Up @@ -171,7 +171,7 @@ The following metadata snippet corresponds to the standard `server.servlet.jsp.c



[[configuration-metadata.manual-hints.value-providers.handle-as]]
[[appendix.configuration-metadata.manual-hints.value-providers.handle-as]]
==== Handle As
The **handle-as** provider lets you substitute the type of the property to a more high-level type.
This typically happens when the property has a `java.lang.String` type, because you do not want your configuration classes to rely on classes that may not be on the classpath.
Expand Down Expand Up @@ -221,7 +221,7 @@ It is actually used internally as a `org.springframework.core.io.Resource` but c



[[configuration-metadata.manual-hints.value-providers.logger-name]]
[[appendix.configuration-metadata.manual-hints.value-providers.logger-name]]
==== Logger Name
The **logger-name** provider auto-completes valid logger names and <<features#features.logging.log-groups,logger groups>>.
Typically, package and class names available in the current project can be auto-completed.
Expand Down Expand Up @@ -308,7 +308,7 @@ As Spring Boot defines a few logger groups out-of-the-box, dedicated value hints



[[configuration-metadata.manual-hints.value-providers.spring-bean-reference]]
[[appendix.configuration-metadata.manual-hints.value-providers.spring-bean-reference]]
==== Spring Bean Reference
The **spring-bean-reference** provider auto-completes the beans that are defined in the configuration of the current project.
This provider supports the following parameters:
Expand Down Expand Up @@ -348,7 +348,7 @@ If you provide that hint, you still need to transform the bean name into an actu



[[configuration-metadata.manual-hints.value-providers.spring-profile-name]]
[[appendix.configuration-metadata.manual-hints.value-providers.spring-profile-name]]
==== Spring Profile Name
The **spring-profile-name** provider auto-completes the Spring profiles that are defined in the configuration of the current project.

Expand Down
@@ -1,5 +1,5 @@
[appendix]
[[dependency-versions]]
[[appendix.dependency-versions]]
= Dependency Versions
include::attributes.adoc[]

Expand Down
@@ -1,4 +1,4 @@
[[dependency-versions.coordinates]]
[[appendix.dependency-versions.coordinates]]
== Managed Dependency Coordinates

The following table provides details of all of the dependency versions that are provided by Spring Boot in its CLI (Command Line Interface), Maven dependency management, and Gradle plugin.
Expand Down
@@ -1,4 +1,4 @@
[[dependency-versions.properties]]
[[appendix.dependency-versions.properties]]
== Version Properties

The following table provides all properties that can be used to override the versions managed by Spring Boot.
Expand Down
Expand Up @@ -4,4 +4,4 @@ Finally, we have a few topics for more advanced users:

* *Spring Boot Applications Deployment:* <<deployment#deployment.cloud, Cloud Deployment>> | <<deployment#deployment.installing.nix-services, OS Service>>
* *Build tool plugins:* <<build-tool-plugins#build-tool-plugins.maven, Maven>> | <<build-tool-plugins#build-tool-plugins.gradle, Gradle>>
* *Appendix:* <<application-properties#application-properties,Application Properties>> | <<configuration-metadata#configuration-metadata,Configuration Metadata>> | <<auto-configuration-classes#auto-configuration-classes,Auto-configuration Classes>> | <<test-auto-configuration#test-auto-configuration,Test Auto-configuration Annotations>> | <<executable-jar#executable-jar,Executable Jars>> | <<dependency-versions#dependency-versions,Dependency Versions>>
* *Appendix:* <<application-properties#appendix.application-properties,Application Properties>> | <<configuration-metadata#appendix.configuration-metadata,Configuration Metadata>> | <<auto-configuration-classes#appendix.auto-configuration-classes,Auto-configuration Classes>> | <<test-auto-configuration#appendix.test-auto-configuration,Test Auto-configuration Annotations>> | <<executable-jar#appendix.executable-jar,Executable Jars>> | <<dependency-versions#appendix.dependency-versions,Dependency Versions>>
@@ -1,5 +1,5 @@
[appendix]
[[executable-jar]]
[[appendix.executable-jar]]
= The Executable Jar Format
include::attributes.adoc[]

Expand Down
@@ -1,4 +1,4 @@
[[executable-jar.alternatives]]
[[appendix.executable-jar.alternatives]]
== Alternative Single Jar Solutions
If the preceding restrictions mean that you cannot use Spring Boot Loader, consider the following alternatives:

Expand Down
@@ -1,4 +1,4 @@
[[executable-jar.jarfile-class]]
[[appendix.executable-jar.jarfile-class]]
== Spring Boot's "`JarFile`" Class
The core class used to support loading nested jars is `org.springframework.boot.loader.jar.JarFile`.
It lets you load jar content from a standard jar file or from nested child jar data.
Expand All @@ -25,7 +25,7 @@ We do not need to unpack the archive, and we do not need to read all entry data



[[executable-jar.jarfile-class.compatibility]]
[[appendix.executable-jar.jarfile-class.compatibility]]
=== Compatibility with the Standard Java "`JarFile`"
Spring Boot Loader strives to remain compatible with existing code and libraries.
`org.springframework.boot.loader.jar.JarFile` extends from `java.util.jar.JarFile` and should work as a drop-in replacement.
Expand Down
@@ -1,4 +1,4 @@
[[executable-jar.launching]]
[[appendix.executable-jar.launching]]
== Launching Executable Jars
The `org.springframework.boot.loader.Launcher` class is a special bootstrap class that is used as an executable jar's main entry point.
It is the actual `Main-Class` in your jar file, and it is used to setup an appropriate `URLClassLoader` and ultimately call your `main()` method.
Expand All @@ -13,7 +13,7 @@ You can add additional locations by setting an environment variable called `LOAD



[[executable-jar.launching.manifest]]
[[appendix.executable-jar.launching.manifest]]
=== Launcher Manifest
You need to specify an appropriate `Launcher` as the `Main-Class` attribute of `META-INF/MANIFEST.MF`.
The actual class that you want to launch (that is, the class that contains a `main` method) should be specified in the `Start-Class` attribute.
Expand Down

0 comments on commit 093e8a5

Please sign in to comment.