Align adoc filename with anchors

See gh-26296
This commit is contained in:
Phillip Webb 2021-04-28 22:34:16 -07:00
parent bd3f4d74be
commit 5dce5ee595
19 changed files with 138 additions and 138 deletions

View File

@ -195,13 +195,13 @@ task documentAutoConfigurationClasses(type: org.springframework.boot.build.autoc
task documentDependencyVersions(type: org.springframework.boot.build.constraints.DocumentConstrainedVersions) {
dependsOn dependencyVersions
constrainedVersions.set(providers.provider { dependencyVersions.constrainedVersions })
outputFile = file("${buildDir}/docs/generated/dependency-versions.adoc")
outputFile = file("${buildDir}/docs/generated/generated-dependency-versions.adoc")
}
task documentVersionProperties(type: org.springframework.boot.build.constraints.DocumentVersionProperties) {
dependsOn dependencyVersions
versionProperties.set(providers.provider { dependencyVersions.versionProperties})
outputFile = file("${buildDir}/docs/generated/version-properties.adoc")
outputFile = file("${buildDir}/docs/generated/generated-version-properties.adoc")
}
task documentConfigurationProperties(type: org.springframework.boot.build.context.properties.DocumentConfigurationProperties) {

View File

@ -127,7 +127,7 @@ The following technology-agnostic endpoints are available:
Disabled by default.
| `startup`
| Shows the <<spring-boot-features.adoc#features.spring-application.startup-tracking,startup steps data>> collected by the `ApplicationStartup`.
| Shows the <<features.adoc#features.spring-application.startup-tracking,startup steps data>> collected by the `ApplicationStartup`.
Requires the `SpringApplication` to be configured with a `BufferingApplicationStartup`.
| `threaddump`
@ -1007,7 +1007,7 @@ If you prefer not to include routing data sources in the indicator's output, set
Applications deployed on Kubernetes can provide information about their internal state with https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes[Container Probes].
Depending on https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/[your Kubernetes configuration], the kubelet will call those probes and react to the result.
Spring Boot manages your <<spring-boot-features.adoc#features.spring-application.application-availability,Application Availability State>> out-of-the-box.
Spring Boot manages your <<features.adoc#features.spring-application.application-availability,Application Availability State>> out-of-the-box.
If deployed in a Kubernetes environment, actuator will gather the "Liveness" and "Readiness" information from the `ApplicationAvailability` interface and use that information in dedicated <<actuator.endpoints.health.auto-configured-health-indicators,Health Indicators>>: `LivenessStateHealthIndicator` and `ReadinessStateHealthIndicator`.
These indicators will be shown on the global health endpoint (`"/actuator/health"`).
They will also be exposed as separate HTTP Probes using <<actuator.endpoints.health.groups, Health Groups>>: `"/actuator/health/liveness"` and `"/actuator/health/readiness"`.
@ -1038,7 +1038,7 @@ These health groups are only enabled automatically if the application is <<deplo
You can enable them in any environment using the configprop:management.endpoint.health.probes.enabled[] configuration property.
NOTE: If an application takes longer to start than the configured liveness period, Kubernetes mention the `"startupProbe"` as a possible solution.
The `"startupProbe"` is not necessarily needed here as the `"readinessProbe"` fails until all startup tasks are done, see <<production-ready-features.adoc#actuator.endpoints.kubernetes-probes.lifecycle,how Probes behave during the application lifecycle>>.
The `"startupProbe"` is not necessarily needed here as the `"readinessProbe"` fails until all startup tasks are done, see <<actuator.adoc#actuator.endpoints.kubernetes-probes.lifecycle,how Probes behave during the application lifecycle>>.
WARNING: If your Actuator endpoints are deployed on a separate management context, be aware that endpoints are then not using the same web infrastructure (port, connection pools, framework components) as the main application.
In this case, a probe check could be successful even if the main application does not work properly (for example, it cannot accept new connections).
@ -1063,11 +1063,11 @@ You can, for example, configure additional Health Indicators:
By default, Spring Boot does not add other Health Indicators to these groups.
The "`liveness`" Probe should not depend on health checks for external systems.
If the <<spring-boot-features.adoc#features.spring-application.application-availability.liveness,Liveness State of an application>> is broken, Kubernetes will try to solve that problem by restarting the application instance.
If the <<features.adoc#features.spring-application.application-availability.liveness,Liveness State of an application>> is broken, Kubernetes will try to solve that problem by restarting the application instance.
This means that if an external system fails (e.g. a database, a Web API, an external cache), Kubernetes might restart all application instances and create cascading failures.
As for the "`readiness`" Probe, the choice of checking external systems must be made carefully by the application developers, i.e. Spring Boot does not include any additional health checks in the readiness probe.
If the <<spring-boot-features.adoc#features.spring-application.application-availability.readiness,Readiness State of an application instance>> is unready, Kubernetes will not route traffic to that instance.
If the <<features.adoc#features.spring-application.application-availability.readiness,Readiness State of an application instance>> is unready, Kubernetes will not route traffic to that instance.
Some external systems might not be shared by application instances, in which case they could quite naturally be included in a readiness probe.
Other external systems might not be essential to the application (the application could have circuit breakers and fallbacks), in which case they definitely should not be included.
Unfortunately, an external system that is shared by all application instances is common, and you have to make a judgement call: include it in the readiness probe and expect that the application is taken out of service when the external service is down, or leave it out and deal with failures higher up the stack, e.g. using a circuit breaker in the caller.
@ -1088,7 +1088,7 @@ An important aspect of the Kubernetes Probes support is its consistency with the
There is a significant difference between the `AvailabilityState` which is the in-memory, internal state of the application
and the actual Probe which exposes that state: depending on the phase of application lifecycle, the Probe might not be available.
Spring Boot publishes <<spring-boot-features.adoc#features.spring-application.application-events-and-listeners,Application Events during startup and shutdown>>,
Spring Boot publishes <<features.adoc#features.spring-application.application-events-and-listeners,Application Events during startup and shutdown>>,
and Probes can listen to such events and expose the `AvailabilityState` information.
The following tables show the `AvailabilityState` and the state of HTTP connectors at different stages.
@ -2210,7 +2210,7 @@ To add to the default tags, provide one or more ``@Bean``s that implement `WebMv
To replace the default tags, provide a `@Bean` that implements `WebMvcTagsProvider`.
TIP: In some cases, exceptions handled in Web controllers are not recorded as request metrics tags.
Applications can opt-in and record exceptions by <<spring-boot-features.adoc#features.developing-web-applications.spring-mvc.error-handling, setting handled exceptions as request attributes>>.
Applications can opt-in and record exceptions by <<features.adoc#features.developing-web-applications.spring-mvc.error-handling, setting handled exceptions as request attributes>>.
@ -2249,7 +2249,7 @@ To add to the default tags, provide one or more ``@Bean``s that implement `WebFl
To replace the default tags, provide a `@Bean` that implements `WebFluxTagsProvider`.
TIP: In some cases, exceptions handled in controllers and handler functions are not recorded as request metrics tags.
Applications can opt-in and record exceptions by <<spring-boot-features.adoc#features.developing-web-applications.spring-webflux.error-handling, setting handled exceptions as request attributes>>.
Applications can opt-in and record exceptions by <<features.adoc#features.developing-web-applications.spring-webflux.error-handling, setting handled exceptions as request attributes>>.

View File

@ -27,7 +27,7 @@ legal
# (documentation-overview.adoc)
# (documentation.adoc)
# 1 = Spring Boot Documentation
boot-documentation=\
documentation
@ -177,7 +177,7 @@ getting-started.whats=next
# (using-spring-boot.adoc)
# (using.adoc)
# 1 = Using Spring Boot
using-boot=\
using
@ -348,7 +348,7 @@ using.whats-next
# (spring-boot-features.adoc)
# (features.adoc)
# 1 = Spring Boot Features
boot-features=\
features
@ -1620,7 +1620,7 @@ features.whats-next
# (production-ready-features.adoc)
# (actuator.adoc)
# 1 = Spring Boot Actuator: Production-ready Features
production-ready=\
actuator
@ -2178,7 +2178,7 @@ deployment.whats-next
# (spring-boot-cli.adoc)
# (cli.adoc)
# 1 = Spring Boot CLI
cli=\
cli
@ -2924,7 +2924,7 @@ common-application-properties.testing
# (appendix-configuration-metadata.adoc)
# (configuration-metadata.adoc)
# 1 = Configuration Metadata
configuration-metadata=\
configuration-metadata
@ -3007,7 +3007,7 @@ configuration-metadata.annotation-processor.adding-additional-metadata
# (appendix-auto-configuration-classes.adoc)
# (auto-configuration-classes.adoc)
# 1 = Auto-configuration Classes
auto-configuration-classes=\
auto-configuration-classes
@ -3022,7 +3022,7 @@ auto-configuration-classes.actuator
# (appendix-test-auto-configuration.adoc)
# (test-auto-configuration.adoc)
# 1 = Test Auto-configuration Annotations
test-auto-configuration=\
test-auto-configuration
@ -3033,7 +3033,7 @@ test-auto-configuration.slices
# (appendix-executable-jar-format.adoc)
# (executable-jar.adoc)
# 1 = The Executable Jar Format
executable-jar=\
executable-jar
@ -3092,7 +3092,7 @@ executable-jar.alternatives
# (appendix-dependency-versions.adoc)
# (dependency-versions.adoc)
# 1 = Dependency versions
dependency-versions=\
dependency-versions

View File

@ -5,7 +5,7 @@ include::attributes.adoc[]
Spring Boot provides build tool plugins for Maven and Gradle.
The plugins offer a variety of features, including the packaging of executable jars.
This section provides more details on both plugins as well as some help should you need to extend an unsupported build system.
If you are just getting started, you might want to read "`<<using-spring-boot.adoc#using.build-systems>>`" from the "`<<using-spring-boot.adoc#using>>`" section first.
If you are just getting started, you might want to read "`<<using.adoc#using.build-systems>>`" from the "`<<using.adoc#using>>`" section first.
@ -54,7 +54,7 @@ You need to remember to start Ant using the `-lib` option, as shown in the follo
$ ant -lib <directory containing spring-boot-antlib-{spring-boot-version}.jar>
----
TIP: The "`Using Spring Boot`" section includes a more complete example of <<using-spring-boot.adoc#using.build-systems.ant, using Apache Ant with `spring-boot-antlib`>>.
TIP: The "`Using Spring Boot`" section includes a more complete example of <<using.adoc#using.build-systems.ant, using Apache Ant with `spring-boot-antlib`>>.
@ -186,7 +186,7 @@ This section contains three examples of using `findmainclass`.
[[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 "`<<appendix-executable-jar-format.adoc#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.adoc#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.

View File

@ -171,7 +171,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 <<appendix-dependency-versions.adoc#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.adoc#dependency-versions,appendix>>.

View File

@ -7,7 +7,7 @@ include::attributes.adoc[]
Various properties can be specified inside your `application.properties` file, inside your `application.yml` file, or as command line switches.
This appendix provides a list of common Spring Boot properties and references to the underlying classes that consume them.
TIP: Spring Boot provides various conversion mechanism with advanced value formatting, make sure to review <<spring-boot-features.adoc#features.external-config.typesafe-configuration-properties.conversion, the properties conversion section>>.
TIP: Spring Boot provides various conversion mechanism with advanced value formatting, make sure to review <<features.adoc#features.external-config.typesafe-configuration-properties.conversion, the properties conversion section>>.
NOTE: Property contributions can come from additional jar files on your classpath, so you should not consider this an exhaustive list.
Also, you can define your own properties.

View File

@ -407,7 +407,7 @@ The following table summarizes the list of supported providers:
| Handles the property as if it were defined by the type defined by the mandatory `target` parameter.
| `logger-name`
| Auto-completes valid logger names and <<spring-boot-features.adoc#features.logging.log-groups,logger groups>>.
| Auto-completes valid logger names and <<features.adoc#features.logging.log-groups,logger groups>>.
Typically, package and class names available in the current project can be auto-completed as well as defined groups.
| `spring-bean-reference`
@ -555,7 +555,7 @@ It is actually used internally as a `org.springframework.core.io.Resource` but c
[[configuration-metadata.manual-hints.value-providers.logger-name]]
==== Logger Name
The **logger-name** provider auto-completes valid logger names and <<spring-boot-features.adoc#features.logging.log-groups,logger groups>>.
The **logger-name** provider auto-completes valid logger names and <<features.adoc#features.logging.log-groups,logger groups>>.
Typically, package and class names available in the current project can be auto-completed.
If groups are enabled (default) and if a custom logger group is identified in the configuration, auto-completion for it should be provided.
Specific frameworks may have extra magic logger names that can be supported as well.

View File

@ -13,7 +13,7 @@ This appendix provides details of the dependencies that are managed by Spring Bo
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.
When you declare a dependency on one of these artifacts without declaring a version, the version listed in the table is used.
include::dependency-versions.adoc[]
include::generated-dependency-versions.adoc[]
@ -24,4 +24,4 @@ The following table provides all properties that can be used to override the ver
Browse the {spring-boot-code}/spring-boot-project/spring-boot-dependencies/build.gradle[`spring-boot-dependencies` build.gradle] for a complete list of dependencies.
You can learn how to customize these versions in your application in the <<build-tool-plugins.adoc#build-tool-plugins,Build Tool Plugins documentation>>.
include::version-properties.adoc[]
include::generated-version-properties.adoc[]

View File

@ -36,7 +36,7 @@ Once you have unpacked the jar file, you can also get an extra boost to startup
NOTE: Using the `JarLauncher` over the application's main method has the added benefit of a predictable classpath order.
The jar contains a `classpath.idx` file which is used by the `JarLauncher` when constructing the classpath.
More efficient container images can also be created by <<spring-boot-features.adoc#features.container-images.building.dockerfiles,creating separate layers>> for your dependencies and application classes and resources (which normally change more frequently).
More efficient container images can also be created by <<features.adoc#features.container-images.building.dockerfiles,creating separate layers>> for your dependencies and application classes and resources (which normally change more frequently).
@ -165,7 +165,7 @@ TIP: The https://github.com/pivotal-cf/java-cfenv/[Java CFEnv] project is a bett
Spring Boot auto-detects Kubernetes deployment environments by checking the environment for `"*_SERVICE_HOST"` and `"*_SERVICE_PORT"` variables.
You can override this detection with the configprop:spring.main.cloud-platform[] configuration property.
Spring Boot helps you to <<spring-boot-features.adoc#features.spring-application.application-availability,manage the state of your application>> and export it with <<production-ready-features.adoc#actuator.endpoints.kubernetes-probes, HTTP Kubernetes Probes using Actuator>>.
Spring Boot helps you to <<features.adoc#features.spring-application.application-availability,manage the state of your application>> and export it with <<actuator.adoc#actuator.endpoints.kubernetes-probes, HTTP Kubernetes Probes using Actuator>>.
@ -856,4 +856,4 @@ Check out the https://www.cloudfoundry.org/[Cloud Foundry], https://www.heroku.c
These are just four of the most popular Java PaaS providers.
Since Spring Boot is so amenable to cloud-based deployment, you can freely consider other providers as well.
The next section goes on to cover the _<<spring-boot-cli.adoc#cli, Spring Boot CLI>>_, or you can jump ahead to read about _<<build-tool-plugins.adoc#build-tool-plugins, build tool plugins>>_.
The next section goes on to cover the _<<cli.adoc#cli, Spring Boot CLI>>_, or you can jump ahead to read about _<<build-tool-plugins.adoc#build-tool-plugins, build tool plugins>>_.

View File

@ -64,37 +64,37 @@ If you are getting started with Spring Boot or 'Spring' in general, start with <
[[documentation.using]]
== Working with Spring Boot
Ready to actually start using Spring Boot? <<using-spring-boot.adoc#using, We have you covered>>:
Ready to actually start using Spring Boot? <<using.adoc#using, We have you covered>>:
* *Build systems:* <<using-spring-boot.adoc#using.build-systems.maven, Maven>> | <<using-spring-boot.adoc#using.build-systems.gradle, Gradle>> | <<using-spring-boot.adoc#using.build-systems.ant, Ant>> | <<using-spring-boot.adoc#using.build-systems.starters, Starters>>
* *Best practices:* <<using-spring-boot.adoc#using.structuring-your-code, Code Structure>> | <<using-spring-boot.adoc#using.configuration-classes, @Configuration>> | <<using-spring-boot.adoc#using.auto-configuration, @EnableAutoConfiguration>> | <<using-spring-boot.adoc#using.spring-beans-and-dependency-injection, Beans and Dependency Injection>>
* *Running your code:* <<using-spring-boot.adoc#using.running-your-application.from-an-ide, IDE>> | <<using-spring-boot.adoc#using.running-your-application.as-a-packaged-application, Packaged>> | <<using-spring-boot.adoc#using.running-your-application.with-the-maven-plugin, Maven>> | <<using-spring-boot.adoc#using.running-your-application.with-the-gradle-plugin, Gradle>>
* *Packaging your app:* <<using-spring-boot.adoc#using.packaging-for-production, Production jars>>
* *Spring Boot CLI:* <<spring-boot-cli.adoc#cli, Using the CLI>>
* *Build systems:* <<using.adoc#using.build-systems.maven, Maven>> | <<using.adoc#using.build-systems.gradle, Gradle>> | <<using.adoc#using.build-systems.ant, Ant>> | <<using.adoc#using.build-systems.starters, Starters>>
* *Best practices:* <<using.adoc#using.structuring-your-code, Code Structure>> | <<using.adoc#using.configuration-classes, @Configuration>> | <<using.adoc#using.auto-configuration, @EnableAutoConfiguration>> | <<using.adoc#using.spring-beans-and-dependency-injection, Beans and Dependency Injection>>
* *Running your code:* <<using.adoc#using.running-your-application.from-an-ide, IDE>> | <<using.adoc#using.running-your-application.as-a-packaged-application, Packaged>> | <<using.adoc#using.running-your-application.with-the-maven-plugin, Maven>> | <<using.adoc#using.running-your-application.with-the-gradle-plugin, Gradle>>
* *Packaging your app:* <<using.adoc#using.packaging-for-production, Production jars>>
* *Spring Boot CLI:* <<cli.adoc#cli, Using the CLI>>
[[documentation.features]]
== Learning About Spring Boot Features
Need more details about Spring Boot's core features?
<<spring-boot-features.adoc#features, The following content is for you>>:
<<features.adoc#features, The following content is for you>>:
* *Core Features:* <<spring-boot-features.adoc#features.spring-application, SpringApplication>> | <<spring-boot-features.adoc#features.external-config, External Configuration>> | <<spring-boot-features.adoc#features.profiles, Profiles>> | <<spring-boot-features.adoc#features.logging, Logging>>
* *Web Applications:* <<spring-boot-features.adoc#features.developing-web-applications.spring-mvc, MVC>> | <<spring-boot-features.adoc#features.developing-web-applications.embedded-container, Embedded Containers>>
* *Working with data:* <<spring-boot-features.adoc#features.sql, SQL>> | <<spring-boot-features.adoc#features.nosql, NO-SQL>>
* *Messaging:* <<spring-boot-features.adoc#features.messaging, Overview>> | <<spring-boot-features.adoc#features.messaging.jms, JMS>>
* *Testing:* <<spring-boot-features.adoc#features.testing, Overview>> | <<spring-boot-features.adoc#features.testing.spring-boot-applications, Boot Applications>> | <<spring-boot-features.adoc#features.testing.utilities, Utils>>
* *Extending:* <<spring-boot-features.adoc#features.developing-auto-configuration, Auto-configuration>> | <<spring-boot-features.adoc#features.developing-auto-configuration.condition-annotations, @Conditions>>
* *Core Features:* <<features.adoc#features.spring-application, SpringApplication>> | <<features.adoc#features.external-config, External Configuration>> | <<features.adoc#features.profiles, Profiles>> | <<features.adoc#features.logging, Logging>>
* *Web Applications:* <<features.adoc#features.developing-web-applications.spring-mvc, MVC>> | <<features.adoc#features.developing-web-applications.embedded-container, Embedded Containers>>
* *Working with data:* <<features.adoc#features.sql, SQL>> | <<features.adoc#features.nosql, NO-SQL>>
* *Messaging:* <<features.adoc#features.messaging, Overview>> | <<features.adoc#features.messaging.jms, JMS>>
* *Testing:* <<features.adoc#features.testing, Overview>> | <<features.adoc#features.testing.spring-boot-applications, Boot Applications>> | <<features.adoc#features.testing.utilities, Utils>>
* *Extending:* <<features.adoc#features.developing-auto-configuration, Auto-configuration>> | <<features.adoc#features.developing-auto-configuration.condition-annotations, @Conditions>>
[[documentation.actuator]]
== Moving to Production
When you are ready to push your Spring Boot application to production, we have <<production-ready-features.adoc#actuator, some tricks>> that you might like:
When you are ready to push your Spring Boot application to production, we have <<actuator.adoc#actuator, some tricks>> that you might like:
* *Management endpoints:* <<production-ready-features.adoc#actuator.endpoints, Overview>>
* *Connection options:* <<production-ready-features.adoc#actuator.monitoring, HTTP>> | <<production-ready-features.adoc#actuator.jmx, JMX>>
* *Monitoring:* <<production-ready-features.adoc#actuator.metrics, Metrics>> | <<production-ready-features.adoc#actuator.auditing, Auditing>> | <<production-ready-features.adoc#actuator.tracing, HTTP Tracing>> | <<production-ready-features.adoc#actuator.process-monitoring, Process>>
* *Management endpoints:* <<actuator.adoc#actuator.endpoints, Overview>>
* *Connection options:* <<actuator.adoc#actuator.monitoring, HTTP>> | <<actuator.adoc#actuator.jmx, JMX>>
* *Monitoring:* <<actuator.adoc#actuator.metrics, Metrics>> | <<actuator.adoc#actuator.auditing, Auditing>> | <<actuator.adoc#actuator.tracing, HTTP Tracing>> | <<actuator.adoc#actuator.process-monitoring, Process>>
@ -104,4 +104,4 @@ Finally, we have a few topics for more advanced users:
* *Spring Boot Applications Deployment:* <<deployment.adoc#deployment.cloud, Cloud Deployment>> | <<deployment.adoc#deployment.installing.nix-services, OS Service>>
* *Build tool plugins:* <<build-tool-plugins.adoc#build-tool-plugins.maven, Maven>> | <<build-tool-plugins.adoc#build-tool-plugins.gradle, Gradle>>
* *Appendix:* <<appendix-application-properties.adoc#common-application-properties,Application Properties>> | <<appendix-configuration-metadata.adoc#configuration-metadata,Configuration Metadata>> | <<appendix-auto-configuration-classes.adoc#auto-configuration-classes,Auto-configuration Classes>> | <<appendix-test-auto-configuration.adoc#test-auto-configuration,Test Auto-configuration Annotations>> | <<appendix-executable-jar-format.adoc#executable-jar,Executable Jars>> | <<appendix-dependency-versions.adoc#dependency-versions,Dependency Versions>>
* *Appendix:* <<common-application-properties.adoc#common-application-properties,Application Properties>> | <<configuration-metadata.adoc#configuration-metadata,Configuration Metadata>> | <<auto-configuration-classes.adoc#auto-configuration-classes,Auto-configuration Classes>> | <<test-auto-configuration.adoc#test-auto-configuration,Test Auto-configuration Annotations>> | <<executable-jar.adoc#executable-jar,Executable Jars>> | <<dependency-versions.adoc#dependency-versions,Dependency Versions>>

View File

@ -4,7 +4,7 @@ include::attributes.adoc[]
This section dives into the details of Spring Boot.
Here you can learn about the key features that you may want to use and customize.
If you have not already done so, you might want to read the "<<getting-started.adoc#getting-started>>" and "<<using-spring-boot.adoc#using>>" sections, so that you have a good grounding of the basics.
If you have not already done so, you might want to read the "<<getting-started.adoc#getting-started>>" and "<<using.adoc#using>>" sections, so that you have a good grounding of the basics.
@ -222,7 +222,7 @@ In addition, you can also obtain availability states by injecting the `Applicati
The "`Liveness`" state of an application tells whether its internal state allows it to work correctly, or recover by itself if it's currently failing.
A broken "`Liveness`" state means that the application is in a state that it cannot recover from, and the infrastructure should restart the application.
NOTE: In general, the "Liveness" state should not be based on external checks, such as <<production-ready-features.adoc#actuator.endpoints.health, Health checks>>.
NOTE: In general, the "Liveness" state should not be based on external checks, such as <<actuator.adoc#actuator.endpoints.health, Health checks>>.
If it did, a failing external system (a database, a Web API, an external cache) would trigger massive restarts and cascading failures across the platform.
The internal state of Spring Boot applications is mostly represented by the Spring `ApplicationContext`.
@ -262,7 +262,7 @@ We can also update the state of the application, when the application breaks and
include::{include-springbootfeatures}/springapplication/availability/LocalCacheVerifier.java[]
----
Spring Boot provides <<production-ready-features.adoc#actuator.endpoints.kubernetes-probes,Kubernetes HTTP probes for "Liveness" and "Readiness" with Actuator Health Endpoints>>.
Spring Boot provides <<actuator.adoc#actuator.endpoints.kubernetes-probes,Kubernetes HTTP probes for "Liveness" and "Readiness" with Actuator Health Endpoints>>.
You can get more guidance about <<deployment.adoc#deployment.cloud.kubernetes,deploying Spring Boot applications on Kubernetes in the dedicated section>>.
@ -457,7 +457,7 @@ Properties are considered in the following order (with values from lower items o
. `properties` attribute on your tests.
Available on {spring-boot-test-module-api}/context/SpringBootTest.html[`@SpringBootTest`] and the <<features.testing.spring-boot-applications.autoconfigured-tests,test annotations for testing a particular slice of your application>>.
. {spring-framework-api}/test/context/TestPropertySource.html[`@TestPropertySource`] annotations on your tests.
. <<using-spring-boot.adoc#using.devtools.globalsettings,Devtools global settings properties>> in the `$HOME/.config/spring-boot` directory when devtools is active.
. <<using.adoc#using.devtools.globalsettings,Devtools global settings properties>> in the `$HOME/.config/spring-boot` directory when devtools is active.
Config data files are considered in the following order:
@ -482,7 +482,7 @@ For one-off testing, you can launch with a specific command line switch (for exa
TIP: The `env` and `configprops` endpoints can be useful in determining why a property has a particular value.
You can use these two endpoints to diagnose unexpected property values.
See the "<<production-ready-features.adoc#actuator.endpoints, Production ready features>>" section for details.
See the "<<actuator.adoc#actuator.endpoints, Production ready features>>" section for details.
@ -1180,7 +1180,7 @@ include::{include-springbootfeatures}/externalizedconfiguration/use/MyService.ja
----
TIP: Using `@ConfigurationProperties` also lets you generate metadata files that can be used by IDEs to offer auto-completion for your own keys.
See the <<appendix-configuration-metadata.adoc#configuration-metadata,appendix>> for details.
See the <<configuration-metadata.adoc#configuration-metadata,appendix>> for details.
@ -1561,7 +1561,7 @@ Doing so avoids any problems that may be caused by early instantiation.
TIP: The `spring-boot-actuator` module includes an endpoint that exposes all `@ConfigurationProperties` beans.
Point your web browser to `/actuator/configprops` or use the equivalent JMX endpoint.
See the "<<production-ready-features.adoc#actuator.endpoints, Production ready features>>" section for details.
See the "<<actuator.adoc#actuator.endpoints, Production ready features>>" section for details.
@ -1578,7 +1578,7 @@ The following table summarizes the features that are supported by `@Configuratio
| Yes
| Limited (see <<boot-features-external-config-vs-value-note,note below>>)
| <<appendix-configuration-metadata.adoc#configuration-metadata,Meta-data support>>
| <<configuration-metadata.adoc#configuration-metadata,Meta-data support>>
| Yes
| No
@ -2564,7 +2564,7 @@ For machine clients, it produces a JSON response with details of the error, the
For browser clients, there is a "`whitelabel`" error view that renders the same data in HTML format (to customize it, add a `View` that resolves to `error`).
There are a number of `server.error` properties that can be set if you want to customize the default error handling behavior.
See the <<appendix-application-properties.adoc#common-application-properties.server, "`Server Properties`">> section of the Appendix.
See the <<common-application-properties.adoc#common-application-properties.server, "`Server Properties`">> section of the Appendix.
To replace the default behavior completely, you can implement `ErrorController` and register a bean definition of that type or add a bean of type `ErrorAttributes` to use the existing mechanism but replace the contents.
@ -2581,7 +2581,7 @@ include::{include-springbootfeatures}/webapplications/servlet/MyControllerAdvice
In the preceding example, if `YourException` is thrown by a controller defined in the same package as `AcmeController`, a JSON representation of the `CustomErrorType` POJO is used instead of the `ErrorAttributes` representation.
In some cases, errors handled at the controller level are not recorded by the <<production-ready-features.adoc#actuator.metrics.supported.spring-mvc, metrics infrastructure>>.
In some cases, errors handled at the controller level are not recorded by the <<actuator.adoc#actuator.metrics.supported.spring-mvc, metrics infrastructure>>.
Applications can ensure that such exceptions are recorded with the request metrics by setting the handled exception as a request attribute:
[source,java,indent=0,subs="verbatim,quotes,attributes"]
@ -2846,7 +2846,7 @@ include::{include-springbootfeatures}/webapplications/webflux/CustomErrorWebExce
For a more complete picture, you can also subclass `DefaultErrorWebExceptionHandler` directly and override specific methods.
In some cases, errors handled at the controller or handler function level are not recorded by the <<production-ready-features.adoc#actuator.metrics.supported.spring-webflux, metrics infrastructure>>.
In some cases, errors handled at the controller or handler function level are not recorded by the <<actuator.adoc#actuator.metrics.supported.spring-webflux, metrics infrastructure>>.
Applications can ensure that such exceptions are recorded with the request metrics by setting the handled exception as a request attribute:
[source,java,indent=0,subs="verbatim,quotes,attributes"]
@ -3860,7 +3860,7 @@ The console is auto-configured when the following conditions are met:
* You are developing a servlet-based web application.
* `com.h2database:h2` is on the classpath.
* You are using <<using-spring-boot.adoc#using.devtools,Spring Boot's developer tools>>.
* You are using <<using.adoc#using.devtools,Spring Boot's developer tools>>.
TIP: If you are not using Spring Boot's developer tools but would still like to make use of H2's console, you can configure the configprop:spring.h2.console.enabled[] property with a value of `true`.
@ -5381,7 +5381,7 @@ You can customize this behaviour using the configprop:spring.kafka.streams.auto-
[[features.messaging.kafka.additional-properties]]
==== Additional Kafka Properties
The properties supported by auto configuration are shown in <<appendix-application-properties.adoc#common-application-properties>>.
The properties supported by auto configuration are shown in <<common-application-properties.adoc#common-application-properties>>.
Note that, for the most part, these properties (hyphenated or camelCase) map directly to the Apache Kafka dotted properties.
Refer to the Apache Kafka documentation for details.
@ -6088,7 +6088,7 @@ When testing Spring Boot applications, this is often not required.
Spring Boot's `@*Test` annotations search for your primary configuration automatically whenever you do not explicitly define one.
The search algorithm works up from the package that contains the test until it finds a class annotated with `@SpringBootApplication` or `@SpringBootConfiguration`.
As long as you <<using-spring-boot.adoc#using.structuring-your-code, structured your code>> in a sensible way, your main configuration is usually found.
As long as you <<using.adoc#using.structuring-your-code, structured your code>> in a sensible way, your main configuration is usually found.
[NOTE]
====
@ -6301,7 +6301,7 @@ To test that object JSON serialization and deserialization is working as expecte
* `Gson`
* `Jsonb`
TIP: A list of the auto-configurations that are enabled by `@JsonTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
TIP: A list of the auto-configurations that are enabled by `@JsonTest` can be <<test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
If you need to configure elements of the auto-configuration, you can use the `@AutoConfigureJsonTesters` annotation.
@ -6336,7 +6336,7 @@ To test whether Spring MVC controllers are working as expected, use the `@WebMvc
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@WebMvcTest` annotation is used.
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
TIP: A list of the auto-configuration settings that are enabled by `@WebMvcTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
TIP: A list of the auto-configuration settings that are enabled by `@WebMvcTest` can be <<test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
TIP: If you need to register extra components, such as the Jackson `Module`, you can import additional configuration classes by using `@Import` on your test.
@ -6384,7 +6384,7 @@ To test that {spring-framework-docs}/web-reactive.html[Spring WebFlux] controlle
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@WebFluxTest` annotation is used.
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
TIP: A list of the auto-configurations that are enabled by `@WebFluxTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
TIP: A list of the auto-configurations that are enabled by `@WebFluxTest` can be <<test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
TIP: If you need to register extra components, such as Jackson `Module`, you can import additional configuration classes using `@Import` on your test.
@ -6420,7 +6420,7 @@ Regular `@Component` and `@ConfigurationProperties` beans are not scanned when t
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
(For more about using Cassandra with Spring Boot, see "<<features.nosql.cassandra>>", earlier in this chapter.)
TIP: A list of the auto-configuration settings that are enabled by `@DataCassandraTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
TIP: A list of the auto-configuration settings that are enabled by `@DataCassandraTest` can be <<test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
The following example shows a typical setup for using Cassandra tests in Spring Boot:
@ -6442,7 +6442,7 @@ This can be disabled using the `showSql()` attribute of the annotation.
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataJpaTest` annotation is used.
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
TIP: A list of the auto-configuration settings that are enabled by `@DataJpaTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
TIP: A list of the auto-configuration settings that are enabled by `@DataJpaTest` can be <<test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
By default, data JPA tests are transactional and roll back at the end of each test.
See the {spring-framework-docs}/testing.html#testcontext-tx-enabling-transactions[relevant section] in the Spring Framework Reference Documentation for more details.
@ -6480,7 +6480,7 @@ By default, it configures an in-memory embedded database and a `JdbcTemplate`.
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@JdbcTest` annotation is used.
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
TIP: A list of the auto-configurations that are enabled by `@JdbcTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
TIP: A list of the auto-configurations that are enabled by `@JdbcTest` can be <<test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
By default, JDBC tests are transactional and roll back at the end of each test.
See the {spring-framework-docs}/testing.html#testcontext-tx-enabling-transactions[relevant section] in the Spring Framework Reference Documentation for more details.
@ -6503,7 +6503,7 @@ By default, it configures an in-memory embedded database, a `JdbcTemplate`, and
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataJdbcTest` annotation is used.
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
TIP: A list of the auto-configurations that are enabled by `@DataJdbcTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
TIP: A list of the auto-configurations that are enabled by `@DataJdbcTest` can be <<test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
By default, Data JDBC tests are transactional and roll back at the end of each test.
See the {spring-framework-docs}/testing.html#testcontext-tx-enabling-transactions[relevant section] in the Spring Framework Reference Documentation for more details.
@ -6523,7 +6523,7 @@ If you want to replace it with an in-memory database, you can use `@AutoConfigur
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@JooqTest` annotation is used.
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
TIP: A list of the auto-configurations that are enabled by `@JooqTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
TIP: A list of the auto-configurations that are enabled by `@JooqTest` can be <<test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
`@JooqTest` configures a `DSLContext`.
The following example shows the `@JooqTest` annotation in use:
@ -6546,7 +6546,7 @@ Regular `@Component` and `@ConfigurationProperties` beans are not scanned when t
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
(For more about using MongoDB with Spring Boot, see "<<features.nosql.mongodb>>", earlier in this chapter.)
TIP: A list of the auto-configuration settings that are enabled by `@DataMongoTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
TIP: A list of the auto-configuration settings that are enabled by `@DataMongoTest` can be <<test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
The following class shows the `@DataMongoTest` annotation in use:
@ -6573,7 +6573,7 @@ Regular `@Component` and `@ConfigurationProperties` beans are not scanned when t
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
(For more about using Neo4J with Spring Boot, see "<<features.nosql.neo4j>>", earlier in this chapter.)
TIP: A list of the auto-configuration settings that are enabled by `@DataNeo4jTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
TIP: A list of the auto-configuration settings that are enabled by `@DataNeo4jTest` can be <<test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
The following example shows a typical setup for using Neo4J tests in Spring Boot:
@ -6604,7 +6604,7 @@ Regular `@Component` and `@ConfigurationProperties` beans are not scanned when t
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
(For more about using Redis with Spring Boot, see "<<features.nosql.redis>>", earlier in this chapter.)
TIP: A list of the auto-configuration settings that are enabled by `@DataRedisTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
TIP: A list of the auto-configuration settings that are enabled by `@DataRedisTest` can be <<test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
The following example shows the `@DataRedisTest` annotation in use:
@ -6623,7 +6623,7 @@ Regular `@Component` and `@ConfigurationProperties` beans are not scanned when t
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
(For more about using LDAP with Spring Boot, see "<<features.nosql.ldap>>", earlier in this chapter.)
TIP: A list of the auto-configuration settings that are enabled by `@DataLdapTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
TIP: A list of the auto-configuration settings that are enabled by `@DataLdapTest` can be <<test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
The following example shows the `@DataLdapTest` annotation in use:
@ -6649,7 +6649,7 @@ By default, it auto-configures Jackson, GSON, and Jsonb support, configures a `R
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@RestClientTest` annotation is used.
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
TIP: A list of the auto-configuration settings that are enabled by `@RestClientTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
TIP: A list of the auto-configuration settings that are enabled by `@RestClientTest` can be <<test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
The specific beans that you want to test should be specified by using the `value` or `components` attribute of `@RestClientTest`, as shown in the following example:
@ -6743,7 +6743,7 @@ By default, it configures a mock `WebServiceServer` bean and automatically custo
(For more about using Web Services with Spring Boot, see "<<features.webservices>>", earlier in this chapter.)
TIP: A list of the auto-configuration settings that are enabled by `@WebServiceClientTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
TIP: A list of the auto-configuration settings that are enabled by `@WebServiceClientTest` can be <<test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
The following example shows the `@WebServiceClientTest` annotation in use:
@ -6779,7 +6779,7 @@ TIP: A slice or `@AutoConfigure...` annotation can be customized this way as lon
[[features.testing.spring-boot-applications.user-configuration-and-slicing]]
==== User Configuration and Slicing
If you <<using-spring-boot.adoc#using.structuring-your-code, structure your code>> in a sensible way, your `@SpringBootApplication` class is <<features.testing.spring-boot-applications.detecting-configuration, used by default>> as the configuration of your tests.
If you <<using.adoc#using.structuring-your-code, structure your code>> in a sensible way, your `@SpringBootApplication` class is <<features.testing.spring-boot-applications.detecting-configuration, used by default>> as the configuration of your tests.
It then becomes important not to litter the application's main class with configuration settings that are specific to a particular area of its functionality.
@ -7253,7 +7253,7 @@ Here are some rules we follow internally to make sure descriptions are consisten
* Use `java.time.Duration` rather than `long` and describe the default unit if it differs from milliseconds, e.g. "If a duration suffix is not specified, seconds will be used".
* Do not provide the default value in the description unless it has to be determined at runtime.
Make sure to <<appendix-configuration-metadata.adoc#configuration-metadata.annotation-processor,trigger meta-data generation>> so that IDE assistance is available for your keys as well.
Make sure to <<configuration-metadata.adoc#configuration-metadata.annotation-processor,trigger meta-data generation>> so that IDE assistance is available for your keys as well.
You may want to review the generated metadata (`META-INF/spring-configuration-metadata.json`) to make sure your keys are properly documented.
Using your own starter in a compatible IDE is also a good idea to validate that quality of the metadata.
@ -7468,7 +7468,7 @@ data class KotlinExampleProperties(
}
----
TIP: To generate <<appendix-configuration-metadata.adoc#configuration-metadata.annotation-processor,your own metadata>> using the annotation processor, {kotlin-docs}kapt.html[`kapt` should be configured] with the `spring-boot-configuration-processor` dependency.
TIP: To generate <<configuration-metadata.adoc#configuration-metadata.annotation-processor,your own metadata>> using the annotation processor, {kotlin-docs}kapt.html[`kapt` should be configured] with the `spring-boot-configuration-processor` dependency.
Note that some features (such as detecting the default value or deprecated items) are not working due to limitations in the model kapt provides.
@ -7662,4 +7662,4 @@ Spring Boot can use that information when serving static resources, but this can
If you want to learn more about any of the classes discussed in this section, you can check out the {spring-boot-api}/[Spring Boot API documentation] or you can browse the {spring-boot-code}[source code directly].
If you have specific questions, take a look at the <<howto.adoc#howto, how-to>> section.
If you are comfortable with Spring Boot's core features, you can continue on and read about <<production-ready-features.adoc#actuator, production-ready features>>.
If you are comfortable with Spring Boot's core features, you can continue on and read about <<actuator.adoc#actuator, production-ready features>>.

View File

@ -108,7 +108,7 @@ Ubuntu users can run `sudo apt-get install maven`.
Windows users with https://chocolatey.org/[Chocolatey] can run `choco install maven` from an elevated (administrator) prompt.
Spring Boot dependencies use the `org.springframework.boot` `groupId`.
Typically, your Maven POM file inherits from the `spring-boot-starter-parent` project and declares dependencies to one or more <<using-spring-boot.adoc#using.build-systems.starters,"`Starters`">>.
Typically, your Maven POM file inherits from the `spring-boot-starter-parent` project and declares dependencies to one or more <<using.adoc#using.build-systems.starters,"`Starters`">>.
Spring Boot also provides an optional <<build-tool-plugins.adoc#build-tool-plugins.maven, Maven plugin>> to create executable jars.
More details on getting started with Spring Boot and Maven can be found in the {spring-boot-maven-plugin-docs}#getting-started[Getting Started section] of the Maven plugin's reference guide.
@ -121,7 +121,7 @@ Spring Boot is compatible with Gradle 6.8 and 7.x.
If you do not already have Gradle installed, you can follow the instructions at https://gradle.org.
Spring Boot dependencies can be declared by using the `org.springframework.boot` `group`.
Typically, your project declares dependencies to one or more <<using-spring-boot.adoc#using.build-systems.starters, "`Starters`">>.
Typically, your project declares dependencies to one or more <<using.adoc#using.build-systems.starters, "`Starters`">>.
Spring Boot provides a useful <<build-tool-plugins.adoc#build-tool-plugins.gradle, Gradle plugin>> that can be used to simplify dependency declarations and to create executable jars.
.Gradle Wrapper
@ -449,7 +449,7 @@ For simplicity, we continue to use a plain text editor for this example.
Spring Boot provides a number of "`Starters`" that let you add jars to your classpath.
Our applications for smoke tests use the `spring-boot-starter-parent` in the `parent` section of the POM.
The `spring-boot-starter-parent` is a special starter that provides useful Maven defaults.
It also provides a <<using-spring-boot.adoc#using.build-systems.dependency-management,`dependency-management`>> section so that you can omit `version` tags for "`blessed`" dependencies.
It also provides a <<using.adoc#using.build-systems.dependency-management,`dependency-management`>> section so that you can omit `version` tags for "`blessed`" dependencies.
Other "`Starters`" provide dependencies that you are likely to need when developing a specific type of application.
Since we are developing a web application, we add a `spring-boot-starter-web` dependency.
@ -604,7 +604,7 @@ An uber jar packages all the classes from all the application's dependencies int
The problem with this approach is that it becomes hard to see which libraries are in your application.
It can also be problematic if the same filename is used (but with different content) in multiple jars.
Spring Boot takes a <<appendix-executable-jar-format.adoc#executable-jar, different approach>> and lets you actually nest jars directly.
Spring Boot takes a <<executable-jar.adoc#executable-jar, different approach>> and lets you actually nest jars directly.
****
To create an executable jar, we need to add the `spring-boot-maven-plugin` to our `pom.xml`.
@ -688,5 +688,5 @@ Hopefully, this section provided some of the Spring Boot basics and got you on y
If you are a task-oriented type of developer, you might want to jump over to https://spring.io and check out some of the https://spring.io/guides/[getting started] guides that solve specific "`How do I do that with Spring?`" problems.
We also have Spring Boot-specific "`<<howto.adoc#howto, How-to>>`" reference documentation.
Otherwise, the next logical step is to read _<<using-spring-boot.adoc#using>>_.
If you are really impatient, you could also jump ahead and read about _<<spring-boot-features.adoc#features, Spring Boot features>>_.
Otherwise, the next logical step is to read _<<using.adoc#using>>_.
If you are really impatient, you could also jump ahead and read about _<<features.adoc#features, Spring Boot features>>_.

View File

@ -48,7 +48,7 @@ The Spring Boot auto-configuration tries its best to "`do the right thing`", but
There is a really useful `ConditionEvaluationReport` available in any Spring Boot `ApplicationContext`.
You can see it if you enable `DEBUG` logging output.
If you use the `spring-boot-actuator` (see <<production-ready-features.adoc#actuator,the Actuator chapter>>), there is also a `conditions` endpoint that renders the report in JSON.
If you use the `spring-boot-actuator` (see <<actuator.adoc#actuator,the Actuator chapter>>), there is also a `conditions` endpoint that renders the report in JSON.
Use that endpoint to debug the application and see what features have been added (and which have not been added) by Spring Boot at runtime.
Many more questions can be answered by looking at the source code and the Javadoc.
@ -80,7 +80,7 @@ There is more than one way to register additional customizations:
* Declaratively, for all applications, by adding a `META-INF/spring.factories` and packaging a jar file that the applications all use as a library.
The `SpringApplication` sends some special `ApplicationEvents` to the listeners (some even before the context is created) and then registers the listeners for events published by the `ApplicationContext` as well.
See "`<<spring-boot-features.adoc#features.spring-application.application-events-and-listeners,Application Events and Listeners>>`" in the '`Spring Boot features`' section for a complete list.
See "`<<features.adoc#features.spring-application.application-events-and-listeners,Application Events and Listeners>>`" in the '`Spring Boot features`' section for a complete list.
It is also possible to customize the `Environment` before the application context is refreshed by using `EnvironmentPostProcessor`.
Each implementation should be registered in `META-INF/spring.factories`, as shown in the following example:
@ -112,7 +112,7 @@ This is too late to configure certain properties such as `+logging.*+` and `+spr
[[howto.application.context-hierarchy]]
=== Build an ApplicationContext Hierarchy (Adding a Parent or Root Context)
You can use the `ApplicationBuilder` class to create parent/child `ApplicationContext` hierarchies.
See "`<<spring-boot-features.adoc#features.spring-application.fluent-builder-api>>`" in the '`Spring Boot features`' section for more information.
See "`<<features.adoc#features.spring-application.fluent-builder-api>>`" in the '`Spring Boot features`' section for more information.
@ -263,7 +263,7 @@ The actual application _now_ shows the banner (as overridden by configuration) a
[[howto.properties-and-configuration.external-properties-location]]
=== Change the Location of External Properties of an Application
By default, properties from different sources are added to the Spring `Environment` in a defined order (see "`<<spring-boot-features.adoc#features.external-config>>`" in the '`Spring Boot features`' section for the exact order).
By default, properties from different sources are added to the Spring `Environment` in a defined order (see "`<<features.adoc#features.external-config>>`" in the '`Spring Boot features`' section for the exact order).
You can also provide the following System properties (or environment variables) to change the behavior:
@ -329,7 +329,7 @@ The preceding example YAML corresponds to the following `application.properties`
server.port=9000
----
See "`<<spring-boot-features.adoc#features.external-config.yaml>>`" in the '`Spring Boot features`' section for more information about YAML.
See "`<<features.adoc#features.external-config.yaml>>`" in the '`Spring Boot features`' section for more information about YAML.
@ -355,7 +355,7 @@ In Spring Boot, you can also set the active profile in `application.properties`,
A value set this way is replaced by the System property or environment variable setting but not by the `SpringApplicationBuilder.profiles()` method.
Thus, the latter Java API can be used to augment the profiles without changing the defaults.
See "`<<spring-boot-features.adoc#features.profiles>>`" in the "`Spring Boot features`" section for more information.
See "`<<features.adoc#features.profiles>>`" in the "`Spring Boot features`" section for more information.
@ -402,7 +402,7 @@ There is not (and technically cannot be) an exhaustive list of all supported pro
A running application with the Actuator features has a `configprops` endpoint that shows all the bound and bindable properties available through `@ConfigurationProperties`.
The appendix includes an <<appendix-application-properties.adoc#common-application-properties, `application.properties`>> example with a list of the most common properties supported by Spring Boot.
The appendix includes an <<common-application-properties.adoc#common-application-properties, `application.properties`>> example with a list of the most common properties supported by Spring Boot.
The definitive list comes from searching the source code for `@ConfigurationProperties` and `@Value` annotations as well as the occasional use of `Binder`.
For more about the exact ordering of loading properties, see "<<spring-boot-features#features.external-config>>".
@ -497,7 +497,7 @@ Thanks to relaxed binding of `Environment` values, you can also use configprop:s
To switch off the HTTP endpoints completely but still create a `WebApplicationContext`, use `server.port=-1` (doing so is sometimes useful for testing).
For more details, see "`<<spring-boot-features.adoc#features.developing-web-applications.embedded-container.customizing>>`" in the '`Spring Boot Features`' section, or the {spring-boot-autoconfigure-module-code}/web/ServerProperties.java[`ServerProperties`] source code.
For more details, see "`<<features.adoc#features.developing-web-applications.embedded-container.customizing>>`" in the '`Spring Boot Features`' section, or the {spring-boot-autoconfigure-module-code}/web/ServerProperties.java[`ServerProperties`] source code.
@ -656,7 +656,7 @@ As of Undertow 1.4.0+, both `h2` and `h2c` are supported on JDK 8 without any ad
=== Configure the Web Server
Generally, you should first consider using one of the many available configuration keys and customize your web server by adding new entries in your `application.properties` (or `application.yml`, or environment, etc. see "`<<howto.properties-and-configuration.discover-build-in-options-for-external-properties>>`").
The `server.{asterisk}` namespace is quite useful here, and it includes namespaces like `server.tomcat.{asterisk}`, `server.jetty.{asterisk}` and others, for server-specific features.
See the list of <<appendix-application-properties.adoc#common-application-properties>>.
See the list of <<common-application-properties.adoc#common-application-properties>>.
The previous sections covered already many common use cases, such as compression, SSL or HTTP/2.
However, if a configuration key doesn't exist for your use case, you should then look at {spring-boot-module-api}/web/server/WebServerFactoryCustomizer.html[`WebServerFactoryCustomizer`].
@ -736,7 +736,7 @@ If no `dispatcherType` is specified on a filter registration, `REQUEST` is used.
This aligns with the Servlet Specification's default dispatcher type.
====
Like any other Spring bean, you can define the order of Servlet filter beans; please make sure to check the "`<<spring-boot-features.adoc#features.developing-web-applications.embedded-container.servlets-filters-listeners.beans>>`" section.
Like any other Spring bean, you can define the order of Servlet filter beans; please make sure to check the "`<<features.adoc#features.developing-web-applications.embedded-container.servlets-filters-listeners.beans>>`" section.
@ -1059,7 +1059,7 @@ These features are described in six enums (in Jackson) that map onto properties
|===
For example, to enable pretty print, set `spring.jackson.serialization.indent_output=true`.
Note that, thanks to the use of <<spring-boot-features.adoc#features.external-config.typesafe-configuration-properties.relaxed-binding, relaxed binding>>, the case of `indent_output` does not have to match the case of the corresponding enum constant, which is `INDENT_OUTPUT`.
Note that, thanks to the use of <<features.adoc#features.external-config.typesafe-configuration-properties.relaxed-binding, relaxed binding>>, the case of `indent_output` does not have to match the case of the corresponding enum constant, which is `INDENT_OUTPUT`.
This environment-based configuration is applied to the auto-configured `Jackson2ObjectMapperBuilder` bean and applies to any mappers created by using the builder, including the auto-configured `ObjectMapper` bean.
@ -1261,7 +1261,7 @@ This section answers questions related to using them.
[[howto.http-clients.rest-template-proxy-configuration]]
=== Configure RestTemplate to Use a Proxy
As described in <<spring-boot-features.adoc#features.resttemplate.customization>>, you can use a `RestTemplateCustomizer` with `RestTemplateBuilder` to build a customized `RestTemplate`.
As described in <<features.adoc#features.resttemplate.customization>>, you can use a `RestTemplateCustomizer` with `RestTemplateBuilder` to build a customized `RestTemplate`.
This is the recommended approach for creating a `RestTemplate` configured to use a proxy.
The exact details of the proxy configuration depend on the underlying client request factory that is being used.
@ -1330,7 +1330,7 @@ By default, Spring Boot picks up the native configuration from its default locat
=== Configure Logback for Logging
If you need to apply customizations to logback beyond those that can be achieved with `application.properties`, you'll need to add a standard logback configuration file.
You can add a `logback.xml` file to the root of your classpath for logback to find.
You can also use `logback-spring.xml` if you want to use the <<spring-boot-features.adoc#features.logging.logback-extensions,Spring Boot Logback extensions>>.
You can also use `logback-spring.xml` if you want to use the <<features.adoc#features.logging.logback-extensions,Spring Boot Logback extensions>>.
TIP: The Logback documentation has a https://logback.qos.ch/manual/configuration.html[dedicated section that covers configuration] in some detail.
@ -1493,7 +1493,7 @@ This section answers questions related to doing so.
=== Configure a Custom DataSource
To configure your own `DataSource`, define a `@Bean` of that type in your configuration.
Spring Boot reuses your `DataSource` anywhere one is required, including database initialization.
If you need to externalize some settings, you can bind your `DataSource` to the environment (see "`<<spring-boot-features.adoc#features.external-config.typesafe-configuration-properties.3rd-party-configuration>>`").
If you need to externalize some settings, you can bind your `DataSource` to the environment (see "`<<features.adoc#features.external-config.typesafe-configuration-properties.3rd-party-configuration>>`").
The following example shows how to define a data source in a bean:
@ -1601,7 +1601,7 @@ This example uses a more generic `configuration` sub namespace as the example do
NOTE: Because your custom configuration chooses to go with Hikari, `app.datasource.type` has no effect.
In practice, the builder is initialized with whatever value you might set there and then overridden by the call to `.type()`.
See "`<<spring-boot-features.adoc#features.sql.datasource>>`" in the "`Spring Boot features`" section and the {spring-boot-autoconfigure-module-code}/jdbc/DataSourceAutoConfiguration.java[`DataSourceAutoConfiguration`] class for more details.
See "`<<features.adoc#features.sql.datasource>>`" in the "`Spring Boot features`" section and the {spring-boot-autoconfigure-module-code}/jdbc/DataSourceAutoConfiguration.java[`DataSourceAutoConfiguration`] class for more details.
@ -1941,7 +1941,7 @@ Be careful when switching from in-memory to a '`real`' database that you do not
You either have to set `ddl-auto` explicitly or use one of the other mechanisms to initialize the database.
NOTE: You can output the schema creation by enabling the `org.hibernate.SQL` logger.
This is done for you automatically if you enable the <<spring-boot-features.adoc#features.logging.console-output,debug mode>>.
This is done for you automatically if you enable the <<features.adoc#features.logging.console-output,debug mode>>.
In addition, a file named `import.sql` in the root of the classpath is executed on startup if Hibernate creates the schema from scratch (that is, if the `ddl-auto` property is set to `create` or `create-drop`).
This can be useful for demos and for testing if you are careful but is probably not something you want to be on the classpath in production.
@ -1967,7 +1967,7 @@ While we do not recommend using multiple data source initialization technologies
This will defer data source initialization until after any `EntityManagerFactory` beans have been created and initialized.
`schema.sql` can then be used to make additions to any schema creation performed by Hibernate and `data.sql` can be used to populate it.
If you are using a <<spring-boot-features.adoc#howto.data-initialization.migration-tool,Higher-level Database Migration Tool>>, like Flyway or Liquibase, you should use them alone to create and initialize the schema.
If you are using a <<features.adoc#howto.data-initialization.migration-tool,Higher-level Database Migration Tool>>, like Flyway or Liquibase, you should use them alone to create and initialize the schema.
Using the basic `schema.sql` and `data.sql` scripts alongside Flyway or Liquibase is not recommended and support will be removed in a future release.
@ -2196,7 +2196,7 @@ See {spring-boot-autoconfigure-module-code}/batch/BatchAutoConfiguration.java[Ba
[[howto.batch.?running-from-the-command-line]]
=== Running from the Command Line
Spring Boot converts any command line argument starting with `--` to a property to add to the `Environment`, see <<spring-boot-features.adoc#features.external-config.command-line-args,accessing command line properties>>.
Spring Boot converts any command line argument starting with `--` to a property to add to the `Environment`, see <<features.adoc#features.external-config.command-line-args,accessing command line properties>>.
This should not be used to pass arguments to batch jobs.
To specify batch arguments on the command line, use the regular format (i.e. without `--`), as shown in the following example:
@ -2238,7 +2238,7 @@ In a standalone application, the Actuator HTTP port defaults to the same as the
To make the application listen on a different port, set the external property: configprop:management.server.port[].
To listen on a completely different network address (such as when you have an internal network for management and an external one for user applications), you can also set `management.server.address` to a valid IP address to which the server is able to bind.
For more detail, see the {spring-boot-actuator-autoconfigure-module-code}/web/server/ManagementServerProperties.java[`ManagementServerProperties`] source code and "`<<production-ready-features.adoc#actuator.monitoring.customizing-management-server-port>>`" in the "`Production-ready features`" section.
For more detail, see the {spring-boot-actuator-autoconfigure-module-code}/web/server/ManagementServerProperties.java[`ManagementServerProperties`] source code and "`<<actuator.adoc#actuator.monitoring.customizing-management-server-port>>`" in the "`Production-ready features`" section.
@ -2257,7 +2257,7 @@ In general, you need a `View` that resolves with a name of `error` or a `@Contro
Unless you replaced some of the default configuration, you should find a `BeanNameViewResolver` in your `ApplicationContext`, so a `@Bean` named `error` would be one way of doing that.
See {spring-boot-autoconfigure-module-code}/web/servlet/error/ErrorMvcAutoConfiguration.java[`ErrorMvcAutoConfiguration`] for more options.
See also the section on "`<<spring-boot-features.adoc#features.developing-web-applications.spring-mvc.error-handling, Error Handling>>`" for details of how to register handlers in the servlet container.
See also the section on "`<<features.adoc#features.developing-web-applications.spring-mvc.error-handling, Error Handling>>`" for details of how to register handlers in the servlet container.
@ -2367,12 +2367,12 @@ This section answers questions about how it works.
[[howto.hotswapping.reload-static-content]]
=== Reload Static Content
There are several options for hot reloading.
The recommended approach is to use <<using-spring-boot.adoc#using.devtools,`spring-boot-devtools`>>, as it provides additional development-time features, such as support for fast application restarts and LiveReload as well as sensible development-time configuration (such as template caching).
The recommended approach is to use <<using.adoc#using.devtools,`spring-boot-devtools`>>, as it provides additional development-time features, such as support for fast application restarts and LiveReload as well as sensible development-time configuration (such as template caching).
Devtools works by monitoring the classpath for changes.
This means that static resource changes must be "built" for the change to take effect.
By default, this happens automatically in Eclipse when you save your changes.
In IntelliJ IDEA, the Make Project command triggers the necessary build.
Due to the <<using-spring-boot.adoc#using.devtools.restart.excluding-resources, default restart exclusions>>, changes to static resources do not trigger a restart of your application.
Due to the <<using.adoc#using.devtools.restart.excluding-resources, default restart exclusions>>, changes to static resources do not trigger a restart of your application.
They do, however, trigger a live reload.
Alternatively, running in an IDE (especially with debugging on) is a good way to do development (all modern IDEs allow reloading of static resources and usually also allow hot-swapping of Java class changes).
@ -2385,7 +2385,7 @@ You can use that with an external css/js compiler process if you are writing tha
[[howto.hotswapping.reload-templates]]
=== Reload Templates without Restarting the Container
Most of the templating technologies supported by Spring Boot include a configuration option to disable caching (described later in this document).
If you use the `spring-boot-devtools` module, these properties are <<using-spring-boot.adoc#using.devtools.property-defaults,automatically configured>> for you at development time.
If you use the `spring-boot-devtools` module, these properties are <<using.adoc#using.devtools.property-defaults,automatically configured>> for you at development time.
@ -2416,7 +2416,7 @@ The `spring-boot-devtools` module includes support for automatic application res
While not as fast as technologies such as https://www.jrebel.com/products/jrebel[JRebel] it is usually significantly faster than a "`cold start`".
You should probably give it a try before investigating some of the more complex reload options discussed later in this document.
For more details, see the <<using-spring-boot.adoc#using.devtools>> section.
For more details, see the <<using.adoc#using.devtools>> section.
@ -2578,7 +2578,7 @@ If your application contains classes that you want to share with other projects,
The separate module can then be depended upon by your application and other projects.
If you cannot rearrange your code as recommended above, Spring Boot's Maven and Gradle plugins must be configured to produce a separate artifact that is suitable for use as a dependency.
The executable archive cannot be used as a dependency as the <<appendix-executable-jar-format.adoc#executable-jar.nested-jars.jar-structure,executable jar format>> packages application classes in `BOOT-INF/classes`.
The executable archive cannot be used as a dependency as the <<executable-jar.adoc#executable-jar.nested-jars.jar-structure,executable jar format>> packages application classes in `BOOT-INF/classes`.
This means that they cannot be found when the executable jar is used as a dependency.
To produce the two artifacts, one that can be used as a dependency and one that is executable, a classifier must be specified.

View File

@ -10,22 +10,22 @@ The reference documentation consists of the following sections:
[horizontal]
<<legal.adoc#legal,Legal>> :: Legal information.
<<documentation-overview.adoc#documentation,Documentation Overview>> :: About the Documentation, Getting Help, First Steps, and more.
<<documentation.adoc#documentation,Documentation Overview>> :: About the Documentation, Getting Help, First Steps, and more.
<<getting-started.adoc#getting-started,Getting Started>> :: Introducing Spring Boot, System Requirements, Servlet Containers, Installing Spring Boot, Developing Your First Spring Boot Application
<<using-spring-boot.adoc#using,Using Spring Boot>> :: Build Systems, Structuring Your Code, Configuration, Spring Beans and Dependency Injection, DevTools, and more.
<<spring-boot-features.adoc#features,Spring Boot Features>> :: Profiles, Logging, Security, Caching, Spring Integration, Testing, and more.
<<production-ready-features.adoc#actuator,Spring Boot Actuator>> :: Monitoring, Metrics, Auditing, and more.
<<using.adoc#using,Using Spring Boot>> :: Build Systems, Structuring Your Code, Configuration, Spring Beans and Dependency Injection, DevTools, and more.
<<features.adoc#features,Spring Boot Features>> :: Profiles, Logging, Security, Caching, Spring Integration, Testing, and more.
<<actuator.adoc#actuator,Spring Boot Actuator>> :: Monitoring, Metrics, Auditing, and more.
<<deployment.adoc#deployment,Deploying Spring Boot Applications>> :: Deploying to the Cloud, Installing as a Unix application.
<<spring-boot-cli.adoc#cli,Spring Boot CLI>> :: Installing the CLI, Using the CLI, Configuring the CLI, and more.
<<cli.adoc#cli,Spring Boot CLI>> :: Installing the CLI, Using the CLI, Configuring the CLI, and more.
<<build-tool-plugins.adoc#build-tool-plugins,Build Tool Plugins>> :: Maven Plugin, Gradle Plugin, Antlib, and more.
<<howto.adoc#howto,"`How-to`" Guides>> :: Application Development, Configuration, Embedded Servers, Data Access, and many more.
The reference documentation has the following appendices:
[horizontal]
<<appendix-application-properties.adoc#common-application-properties,Application Properties>> :: Common application properties that can be used to configure your application.
<<appendix-configuration-metadata.adoc#configuration-metadata,Configuration Metadata>> :: Metadata used to describe configuration properties.
<<appendix-auto-configuration-classes.adoc#auto-configuration-classes,Auto-configuration Classes>> :: Auto-configuration classes provided by Spring Boot.
<<appendix-test-auto-configuration.adoc#test-auto-configuration,Test Auto-configuration Annotations>> :: Test-autoconfiguration annotations used to test slices of your application.
<<appendix-executable-jar-format.adoc#executable-jar,Executable Jars>> :: Spring Boot's executable jars, their launchers, and their format.
<<appendix-dependency-versions.adoc#dependency-versions,Dependency Versions>> :: Details of the dependencies that are managed by Spring Boot.
<<common-application-properties.adoc#common-application-properties,Application Properties>> :: Common application properties that can be used to configure your application.
<<configuration-metadata.adoc#configuration-metadata,Configuration Metadata>> :: Metadata used to describe configuration properties.
<<auto-configuration-classes.adoc#auto-configuration-classes,Auto-configuration Classes>> :: Auto-configuration classes provided by Spring Boot.
<<test-auto-configuration.adoc#test-auto-configuration,Test Auto-configuration Annotations>> :: Test-autoconfiguration annotations used to test slices of your application.
<<executable-jar.adoc#executable-jar,Executable Jars>> :: Spring Boot's executable jars, their launchers, and their format.
<<dependency-versions.adoc#dependency-versions,Dependency Versions>> :: Details of the dependencies that are managed by Spring Boot.

View File

@ -7,13 +7,13 @@ include::attributes.adoc[]
*{spring-boot-version}*
include::legal.adoc[leveloffset=+1]
include::documentation-overview.adoc[leveloffset=+1]
include::documentation.adoc[leveloffset=+1]
include::getting-started.adoc[leveloffset=+1]
include::using-spring-boot.adoc[leveloffset=+1]
include::spring-boot-features.adoc[leveloffset=+1]
include::production-ready-features.adoc[leveloffset=+1]
include::using.adoc[leveloffset=+1]
include::features.adoc[leveloffset=+1]
include::actuator.adoc[leveloffset=+1]
include::deployment.adoc[leveloffset=+1]
include::spring-boot-cli.adoc[leveloffset=+1]
include::cli.adoc[leveloffset=+1]
include::build-tool-plugins.adoc[leveloffset=+1]
include::howto.adoc[leveloffset=+1]
@ -22,9 +22,9 @@ include::howto.adoc[leveloffset=+1]
[[appendix]]
== Appendices
include::appendix-application-properties.adoc[leveloffset=+2]
include::appendix-configuration-metadata.adoc[leveloffset=+2]
include::appendix-auto-configuration-classes.adoc[leveloffset=+2]
include::appendix-test-auto-configuration.adoc[leveloffset=+2]
include::appendix-executable-jar-format.adoc[leveloffset=+2]
include::appendix-dependency-versions.adoc[leveloffset=+2]
include::common-application-properties.adoc[leveloffset=+2]
include::configuration-metadata.adoc[leveloffset=+2]
include::auto-configuration-classes.adoc[leveloffset=+2]
include::test-auto-configuration.adoc[leveloffset=+2]
include::executable-jar.adoc[leveloffset=+2]
include::dependency-versions.adoc[leveloffset=+2]

View File

@ -143,7 +143,7 @@ The following application starters are provided by Spring Boot under the `org.sp
.Spring Boot application starters
include::starters/application-starters.adoc[]
In addition to the application starters, the following starters can be used to add _<<production-ready-features.adoc#actuator, production ready>>_ features:
In addition to the application starters, the following starters can be used to add _<<actuator.adoc#actuator, production ready>>_ features:
.Spring Boot production starters
include::starters/production-starters.adoc[]
@ -811,7 +811,7 @@ This allows you to share the devtools global configuration with applications tha
====
Profiles are not supported in devtools properties/yaml files.
Any profiles activated in `.spring-boot-devtools.properties` will not affect the loading of <<spring-boot-features.adoc#features.external-config.files.profile-specific, profile-specific configuration files>>.
Any profiles activated in `.spring-boot-devtools.properties` will not affect the loading of <<features.adoc#features.external-config.files.profile-specific, profile-specific configuration files>>.
Profile specific filenames (of the form `spring-boot-devtools-<profile>.properties`) and `spring.config.activate.on-profile` documents in both YAML and Properties files are not supported.
====
@ -940,7 +940,7 @@ Executable jars can be used for production deployment.
As they are self-contained, they are also ideally suited for cloud-based deployment.
For additional "`production ready`" features, such as health, auditing, and metric REST or JMX end-points, consider adding `spring-boot-actuator`.
See _<<production-ready-features.adoc#actuator>>_ for details.
See _<<actuator.adoc#actuator>>_ for details.