mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Merge branch '3.3.x'
This commit is contained in:
commit
28dc9cbb59
|
@ -39,10 +39,10 @@ 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.
|
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` group id.
|
Spring Boot dependencies use the `org.springframework.boot` group id.
|
||||||
Typically, your Maven POM file inherits from the `spring-boot-starter-parent` project and declares dependencies to one or more xref:reference:using/build-systems.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 xref:reference:using/build-systems.adoc#using.build-systems.starters[starters].
|
||||||
Spring Boot also provides an optional xref:maven-plugin:index.adoc[Maven plugin] to create executable jars.
|
Spring Boot also provides an optional xref:maven-plugin:index.adoc[Maven plugin] to create executable jars.
|
||||||
|
|
||||||
More details on getting started with Spring Boot and Maven can be found in the xref:maven-plugin:getting-started.adoc[Getting Started section] of the Maven plugin's reference guide.
|
More details on getting started with Spring Boot and Maven can be found in the xref:maven-plugin:getting-started.adoc[] section of the Maven plugin's reference guide.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ Spring Boot is compatible with Gradle 7.x (7.6.4 or later) or 8.x (8.3 or later)
|
||||||
If you do not already have Gradle installed, you can follow the instructions at https://gradle.org.
|
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`.
|
Spring Boot dependencies can be declared by using the `org.springframework.boot` `group`.
|
||||||
Typically, your project declares dependencies to one or more xref:reference:using/build-systems.adoc#using.build-systems.starters["`Starters`"].
|
Typically, your project declares dependencies to one or more xref:reference:using/build-systems.adoc#using.build-systems.starters[starters].
|
||||||
Spring Boot provides a useful xref:gradle-plugin:index.adoc[Gradle plugin] that can be used to simplify dependency declarations and to create executable jars.
|
Spring Boot provides a useful xref:gradle-plugin:index.adoc[Gradle plugin] that can be used to simplify dependency declarations and to create executable jars.
|
||||||
|
|
||||||
.Gradle Wrapper
|
.Gradle Wrapper
|
||||||
|
@ -63,7 +63,7 @@ It is a small script and library that you commit alongside your code to bootstra
|
||||||
See {url-gradle-docs}/gradle_wrapper.html for details.
|
See {url-gradle-docs}/gradle_wrapper.html for details.
|
||||||
****
|
****
|
||||||
|
|
||||||
More details on getting started with Spring Boot and Gradle can be found in the xref:gradle-plugin:getting-started.adoc[Getting Started section] of the Gradle plugin's reference guide.
|
More details on getting started with Spring Boot and Gradle can be found in the xref:gradle-plugin:getting-started.adoc[] section of the Gradle plugin's reference guide.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@ If you are more than one release behind, please make sure that you also review t
|
||||||
[[upgrading.from-1x]]
|
[[upgrading.from-1x]]
|
||||||
== Upgrading From 1.x
|
== Upgrading From 1.x
|
||||||
|
|
||||||
If you are upgrading from the `1.x` release of Spring Boot, check the {url-github-wiki}/Spring-Boot-2.0-Migration-Guide["`migration guide`" on the project wiki] that provides detailed upgrade instructions.
|
If you are upgrading from the `1.x` release of Spring Boot, check the {url-github-wiki}/Spring-Boot-2.0-Migration-Guide[migration guide] on the project wiki that provides detailed upgrade instructions.
|
||||||
Check also the {url-github-wiki}["`release notes`"] for a list of "`new and noteworthy`" features for each release.
|
Check also the {url-github-wiki}[release notes] for a list of "`new and noteworthy`" features for each release.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
|
|
||||||
The following table provides all properties that can be used to override the versions managed by Spring Boot.
|
The following table provides all properties that can be used to override the versions managed by Spring Boot.
|
||||||
Browse the {code-spring-boot}/spring-boot-project/spring-boot-dependencies/build.gradle[`spring-boot-dependencies` build.gradle] for a complete list of dependencies.
|
Browse the {code-spring-boot}/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 xref:build-tool-plugin:index.adoc[Build Tool Plugins documentation].
|
You can learn how to customize these versions in your application in the xref:build-tool-plugin:index.adoc[] documentation.
|
||||||
|
|
||||||
include::partial$dependency-versions/documented-properties.adoc[]
|
include::partial$dependency-versions/documented-properties.adoc[]
|
||||||
|
|
|
@ -30,8 +30,8 @@ TIP: The "`Using Spring Boot`" section includes a more complete example of xref:
|
||||||
|
|
||||||
Once the `spring-boot-antlib` namespace has been declared, the following additional tasks are available:
|
Once the `spring-boot-antlib` namespace has been declared, the following additional tasks are available:
|
||||||
|
|
||||||
* xref:antlib.adoc#build-tool-plugins.antlib.tasks.exejar[Using the "`exejar`" Task]
|
* xref:antlib.adoc#build-tool-plugins.antlib.tasks.exejar[]
|
||||||
* xref:antlib.adoc#build-tool-plugins.antlib.findmainclass[Using the "`findmainclass`" Task]
|
* xref:antlib.adoc#build-tool-plugins.antlib.findmainclass[]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,5 +4,5 @@
|
||||||
Spring Boot provides build tool plugins for Maven and Gradle.
|
Spring Boot provides build tool plugins for Maven and Gradle.
|
||||||
The plugins offer a variety of features, including the packaging of executable jars.
|
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.
|
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 "`xref:reference:using/build-systems.adoc[Build Systems]`" from the "`xref:reference:using/index.adoc[Developing with Spring Boot]`" section first.
|
If you are just getting started, you might want to read xref:reference:using/build-systems.adoc[] from the xref:reference:using/index.adoc[] section first.
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
= Supporting 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.
|
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 "`xref:specification:/executable-jar/index.adoc[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 xref:specification:/executable-jar/index.adoc[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.
|
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.
|
If you need to, you may use this library directly.
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
= Installing the CLI
|
= Installing the CLI
|
||||||
|
|
||||||
The Spring Boot CLI (Command-Line Interface) can be installed manually by using SDKMAN! (the SDK Manager) or by using Homebrew or MacPorts if you are an OSX user.
|
The Spring Boot CLI (Command-Line Interface) can be installed manually by using SDKMAN! (the SDK Manager) or by using Homebrew or MacPorts if you are an OSX user.
|
||||||
See xref:ROOT:installing.adoc#getting-started.installing.cli[_Installing the Spring Boot CLI_] in the "`Getting started`" section for comprehensive installation instructions.
|
See xref:ROOT:installing.adoc#getting-started.installing.cli[] in the "`Getting Started`" section for comprehensive installation instructions.
|
||||||
|
|
|
@ -13,7 +13,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 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.
|
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 xref:api:java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementServerProperties.html[`ManagementServerProperties`] source code and "`xref:reference:actuator/monitoring.adoc#actuator.monitoring.customizing-management-server-port[Customizing the Management Server Port]`" in the "`Production-ready features`" section.
|
For more detail, see the xref:api:java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementServerProperties.html[`ManagementServerProperties`] source code and xref:reference:actuator/monitoring.adoc#actuator.monitoring.customizing-management-server-port[Customizing the Management Server Port] in the "`Production-Ready Features`" section.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,7 +33,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.
|
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 {code-spring-boot-autoconfigure-src}/web/servlet/error/ErrorMvcAutoConfiguration.java[`ErrorMvcAutoConfiguration`] for more options.
|
See {code-spring-boot-autoconfigure-src}/web/servlet/error/ErrorMvcAutoConfiguration.java[`ErrorMvcAutoConfiguration`] for more options.
|
||||||
|
|
||||||
See also the section on "`xref:reference:web/servlet.adoc#web.servlet.spring-mvc.error-handling[Error Handling]`" for details of how to register handlers in the servlet container.
|
See also the section on xref:reference:web/servlet.adoc#web.servlet.spring-mvc.error-handling[] for details of how to register handlers in the servlet container.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,10 +36,10 @@ 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`.
|
There is a really useful `ConditionEvaluationReport` available in any Spring Boot `ApplicationContext`.
|
||||||
You can see it if you enable `DEBUG` logging output.
|
You can see it if you enable `DEBUG` logging output.
|
||||||
If you use the `spring-boot-actuator` (see xref:actuator.adoc[the Actuator chapter]), there is also a `conditions` endpoint that renders the report in JSON.
|
If you use the `spring-boot-actuator` (see the xref:actuator.adoc[] section), 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.
|
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.
|
Many more questions can be answered by looking at the source code and the API documentation.
|
||||||
When reading the code, remember the following rules of thumb:
|
When reading the code, remember the following rules of thumb:
|
||||||
|
|
||||||
* Look for classes called `+*AutoConfiguration+` and read their sources.
|
* Look for classes called `+*AutoConfiguration+` and read their sources.
|
||||||
|
@ -68,7 +68,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.
|
* 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.
|
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 "`xref:reference:features/spring-application.adoc#features.spring-application.application-events-and-listeners[Application Events and Listeners]`" in the '`Spring Boot features`' section for a complete list.
|
See xref:reference:features/spring-application.adoc#features.spring-application.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`.
|
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:
|
Each implementation should be registered in `META-INF/spring.factories`, as shown in the following example:
|
||||||
|
@ -98,7 +98,7 @@ This is too late to configure certain properties such as `+logging.*+` and `+spr
|
||||||
== Build an ApplicationContext Hierarchy (Adding a Parent or Root Context)
|
== Build an ApplicationContext Hierarchy (Adding a Parent or Root Context)
|
||||||
|
|
||||||
You can use the `ApplicationBuilder` class to create parent/child `ApplicationContext` hierarchies.
|
You can use the `ApplicationBuilder` class to create parent/child `ApplicationContext` hierarchies.
|
||||||
See "`xref:reference:features/spring-application.adoc#features.spring-application.fluent-builder-api[Fluent Builder API]`" in the '`Spring Boot features`' section for more information.
|
See xref:reference:features/spring-application.adoc#features.spring-application.fluent-builder-api[] in the "`Spring Boot Features`" section for more information.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ Spring Batch expects a single `DataSource` by default.
|
||||||
To have it use a `DataSource` other than the application’s main `DataSource`, declare a `DataSource` bean, annotating its `@Bean` method with `@BatchDataSource`.
|
To have it use a `DataSource` other than the application’s main `DataSource`, declare a `DataSource` bean, annotating its `@Bean` method with `@BatchDataSource`.
|
||||||
If you do so and want two data sources, remember to mark the other one `@Primary`.
|
If you do so and want two data sources, remember to mark the other one `@Primary`.
|
||||||
To take greater control, add `@EnableBatchProcessing` to one of your `@Configuration` classes or extend `DefaultBatchConfiguration`.
|
To take greater control, add `@EnableBatchProcessing` to one of your `@Configuration` classes or extend `DefaultBatchConfiguration`.
|
||||||
See the Javadoc of {url-spring-batch-javadoc}/org/springframework/batch/core/configuration/annotation/EnableBatchProcessing.html[`@EnableBatchProcessing`]
|
See the API documentation of {url-spring-batch-javadoc}/org/springframework/batch/core/configuration/annotation/EnableBatchProcessing.html[`@EnableBatchProcessing`]
|
||||||
and {url-spring-batch-javadoc}/org/springframework/batch/core/configuration/support/DefaultBatchConfiguration.html[`DefaultBatchConfiguration`] for more details.
|
and {url-spring-batch-javadoc}/org/springframework/batch/core/configuration/support/DefaultBatchConfiguration.html[`DefaultBatchConfiguration`] for more details.
|
||||||
|
|
||||||
For more info about Spring Batch, see the {url-spring-batch-site}[Spring Batch project page].
|
For more info about Spring Batch, see the {url-spring-batch-site}[Spring Batch project page].
|
||||||
|
@ -24,7 +24,7 @@ For more info about Spring Batch, see the {url-spring-batch-site}[Spring Batch p
|
||||||
[[howto.batch.specifying-a-transaction-manager]]
|
[[howto.batch.specifying-a-transaction-manager]]
|
||||||
== Specifying a Batch Transaction Manager
|
== Specifying a Batch Transaction Manager
|
||||||
|
|
||||||
Similar to xref:batch.adoc#howto.batch.specifying-a-data-source[Specifying a Batch Data Source], you can define a `PlatformTransactionManager` for use in the batch processing by marking it as `@BatchTransactionManager`.
|
Similar to xref:batch.adoc#howto.batch.specifying-a-data-source[], you can define a `PlatformTransactionManager` for use in the batch processing by marking it as `@BatchTransactionManager`.
|
||||||
If you do so and want two transaction managers, remember to mark the other one as `@Primary`.
|
If you do so and want two transaction managers, remember to mark the other one as `@Primary`.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -96,9 +96,9 @@ The Spring Boot plugins for Maven and Gradle allow these managed dependency vers
|
||||||
WARNING: Each Spring Boot release is designed and tested against this specific set of third-party dependencies.
|
WARNING: Each Spring Boot release is designed and tested against this specific set of third-party dependencies.
|
||||||
Overriding versions may cause compatibility issues.
|
Overriding versions may cause compatibility issues.
|
||||||
|
|
||||||
To override dependency versions with Maven, see xref:maven-plugin:using.adoc[this section] of the Maven plugin's documentation.
|
To override dependency versions with Maven, see xref:maven-plugin:using.adoc[] in the Maven plugin's documentation.
|
||||||
|
|
||||||
To override dependency versions in Gradle, see xref:gradle-plugin:managing-dependencies.adoc#managing-dependencies.dependency-management-plugin.customizing[this section] of the Gradle plugin's documentation.
|
To override dependency versions in Gradle, see xref:gradle-plugin:managing-dependencies.adoc#managing-dependencies.dependency-management-plugin.customizing[] in the Gradle plugin's documentation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
= Class Data Sharing
|
= Class Data Sharing
|
||||||
|
|
||||||
This section includes information about using Class Data Sharing (CDS) with Spring Boot applications.
|
This section includes information about using Class Data Sharing (CDS) with Spring Boot applications.
|
||||||
For an overview of Spring Boot support for CDS, see xref:reference:packaging/class-data-sharing.adoc[Class Data Sharing].
|
For an overview of Spring Boot support for CDS, see xref:reference:packaging/class-data-sharing.adoc[].
|
||||||
|
|
||||||
|
|
||||||
[[howto.class-data-sharing.buildpacks]]
|
[[howto.class-data-sharing.buildpacks]]
|
||||||
|
|
|
@ -11,7 +11,7 @@ This section answers questions related to doing so.
|
||||||
|
|
||||||
To configure your own `DataSource`, define a `@Bean` of that type in your configuration.
|
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.
|
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 "`xref:reference:features/external-config.adoc#features.external-config.typesafe-configuration-properties.third-party-configuration[Third-party Configuration]`").
|
If you need to externalize some settings, you can bind your `DataSource` to the environment (see xref:reference:features/external-config.adoc#features.external-config.typesafe-configuration-properties.third-party-configuration[]).
|
||||||
|
|
||||||
The following example shows how to define a data source in a bean:
|
The following example shows how to define a data source in a bean:
|
||||||
|
|
||||||
|
@ -103,7 +103,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.
|
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()`.
|
In practice, the builder is initialized with whatever value you might set there and then overridden by the call to `.type()`.
|
||||||
|
|
||||||
See "`xref:reference:data/sql.adoc#data.sql.datasource[Configure a DataSource]`" in the "`Spring Boot features`" section and the {code-spring-boot-autoconfigure-src}/jdbc/DataSourceAutoConfiguration.java[`DataSourceAutoConfiguration`] class for more details.
|
See xref:reference:data/sql.adoc#data.sql.datasource[] in the "`Spring Boot Features`" section and the {code-spring-boot-autoconfigure-src}/jdbc/DataSourceAutoConfiguration.java[`DataSourceAutoConfiguration`] class for more details.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ This will defer data source initialization until after any `EntityManagerFactory
|
||||||
NOTE: The initialization scripts support `--` for single line comments and `/++*++ ++*++/` for block comments.
|
NOTE: The initialization scripts support `--` for single line comments and `/++*++ ++*++/` for block comments.
|
||||||
Other comment formats are not supported.
|
Other comment formats are not supported.
|
||||||
|
|
||||||
If you are using a xref:data-initialization.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 xref:data-initialization.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.
|
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.
|
||||||
|
|
||||||
If you need to initialize test data using a higher-level database migration tool, please see the sections about xref:data-initialization.adoc#howto.data-initialization.migration-tool.flyway-tests[Flyway] and xref:data-initialization.adoc#howto.data-initialization.migration-tool.liquibase-tests[Liquibase].
|
If you need to initialize test data using a higher-level database migration tool, please see the sections about xref:data-initialization.adoc#howto.data-initialization.migration-tool.flyway-tests[Flyway] and xref:data-initialization.adoc#howto.data-initialization.migration-tool.liquibase-tests[Liquibase].
|
||||||
|
|
|
@ -100,7 +100,7 @@ include-code::MyBean[]
|
||||||
|
|
||||||
All Cloud Foundry properties are prefixed with `vcap`.
|
All Cloud Foundry properties are prefixed with `vcap`.
|
||||||
You can use `vcap` properties to access application information (such as the public URL of the application) and service information (such as database credentials).
|
You can use `vcap` properties to access application information (such as the public URL of the application) and service information (such as database credentials).
|
||||||
See the xref:api:java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.html[`CloudFoundryVcapEnvironmentPostProcessor`] Javadoc for complete details.
|
See the xref:api:java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.html[`CloudFoundryVcapEnvironmentPostProcessor`] API documentation for complete details.
|
||||||
|
|
||||||
TIP: The https://github.com/pivotal-cf/java-cfenv/[Java CFEnv] project is a better fit for tasks such as configuring a DataSource.
|
TIP: The https://github.com/pivotal-cf/java-cfenv/[Java CFEnv] project is a better fit for tasks such as configuring a DataSource.
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ dependencies {
|
||||||
TIP: `providedRuntime` is preferred to Gradle's `compileOnly` configuration.
|
TIP: `providedRuntime` is preferred to Gradle's `compileOnly` configuration.
|
||||||
Among other limitations, `compileOnly` dependencies are not on the test classpath, so any web-based integration tests fail.
|
Among other limitations, `compileOnly` dependencies are not on the test classpath, so any web-based integration tests fail.
|
||||||
|
|
||||||
If you use the xref:build-tool-plugin:index.adoc[Spring Boot build tools], marking the embedded servlet container dependency as provided produces an executable war file with the provided dependencies packaged in a `lib-provided` directory.
|
If you use the Spring Boot xref:build-tool-plugin:index.adoc[], marking the embedded servlet container dependency as provided produces an executable war file with the provided dependencies packaged in a `lib-provided` directory.
|
||||||
This means that, in addition to being deployable to a servlet container, you can also run your application by using `java -jar` on the command line.
|
This means that, in addition to being deployable to a servlet container, you can also run your application by using `java -jar` on the command line.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,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`".
|
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.
|
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 xref:reference:using/devtools.adoc[Developer Tools] section.
|
For more details, see the xref:reference:using/devtools.adoc[] section.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ By default, Spring Boot picks up the native configuration from its default locat
|
||||||
|
|
||||||
If you need to apply customizations to logback beyond those that can be achieved with `application.properties`, you will need to add a standard logback configuration file.
|
If you need to apply customizations to logback beyond those that can be achieved with `application.properties`, you will 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 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 xref:reference:features/logging.adoc#features.logging.logback-extensions[Spring Boot Logback extensions].
|
You can also use `logback-spring.xml` if you want to use the Spring Boot xref:reference:features/logging.adoc#features.logging.logback-extensions[].
|
||||||
|
|
||||||
TIP: The Logback documentation has a https://logback.qos.ch/manual/configuration.html[dedicated section that covers configuration] in some detail.
|
TIP: The Logback documentation has a https://logback.qos.ch/manual/configuration.html[dedicated section that covers configuration] in some detail.
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ The included `HELP.md` file will provide getting started hints.
|
||||||
== Sample Application
|
== Sample Application
|
||||||
|
|
||||||
We need an example application that we can use to create our native image.
|
We need an example application that we can use to create our native image.
|
||||||
For our purposes, the simple "Hello World!" web application that's covered in the xref:tutorial:first-application/index.adoc[Developing Your First Spring Boot Application] section will suffice.
|
For our purposes, the simple "Hello World!" web application that's covered in the xref:tutorial:first-application/index.adoc[] section will suffice.
|
||||||
|
|
||||||
To recap, our main application code looks like this:
|
To recap, our main application code looks like this:
|
||||||
|
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
|
|
||||||
This section contains details on developing and testing Spring Boot applications as GraalVM native images.
|
This section contains details on developing and testing Spring Boot applications as GraalVM native images.
|
||||||
|
|
||||||
TIP: For an overview of GraalVM native image concepts, see the xref:reference:packaging/native-image/introducing-graalvm-native-images.adoc[Introducing GraalVM Native Images] section.
|
TIP: For an overview of GraalVM native image concepts, see the xref:reference:packaging/native-image/introducing-graalvm-native-images.adoc[] section.
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ The application sources are:
|
||||||
[[howto.properties-and-configuration.external-properties-location]]
|
[[howto.properties-and-configuration.external-properties-location]]
|
||||||
== Change the Location of External Properties of an Application
|
== 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 "`xref:reference:features/external-config.adoc[Externalized Configuration]`" 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 xref:reference:features/external-config.adoc[] 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:
|
You can also provide the following System properties (or environment variables) to change the behavior:
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ spring.datasource.url=jdbc:mysql://localhost/test
|
||||||
server.port=9000
|
server.port=9000
|
||||||
----
|
----
|
||||||
|
|
||||||
See "`xref:reference:features/external-config.adoc#features.external-config.yaml[Working With YAML]`" in the '`Spring Boot features`' section for more information about YAML.
|
See xref:reference:features/external-config.adoc#features.external-config.yaml[] in the "`Spring Boot Features'" section for more information about YAML.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ spring:
|
||||||
A value set this way is replaced by the System property or environment variable setting but not by the `SpringApplicationBuilder.profiles()` method.
|
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.
|
Thus, the latter Java API can be used to augment the profiles without changing the defaults.
|
||||||
|
|
||||||
See "`xref:reference:features/profiles.adoc[Profiles]`" in the "`Spring Boot features`" section for more information.
|
See xref:reference:features/profiles.adoc[] in the "`Spring Boot Features`" section for more information.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -255,14 +255,14 @@ spring:
|
||||||
default: "dev"
|
default: "dev"
|
||||||
----
|
----
|
||||||
|
|
||||||
See "`xref:reference:features/profiles.adoc[Profiles]`" in the "`Spring Boot features`" section for more information.
|
See xref:reference:features/profiles.adoc[] in the "`Spring Boot Features`" section for more information.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[[howto.properties-and-configuration.change-configuration-depending-on-the-environment]]
|
[[howto.properties-and-configuration.change-configuration-depending-on-the-environment]]
|
||||||
== Change Configuration Depending on the Environment
|
== Change Configuration Depending on the Environment
|
||||||
|
|
||||||
Spring Boot supports multi-document YAML and Properties files (see xref:reference:features/external-config.adoc#features.external-config.files.multi-document[Working With Multi-Document Files] for details) which can be activated conditionally based on the active profiles.
|
Spring Boot supports multi-document YAML and Properties files (see xref:reference:features/external-config.adoc#features.external-config.files.multi-document[] for details) which can be activated conditionally based on the active profiles.
|
||||||
|
|
||||||
If a document contains a `spring.config.activate.on-profile` key, then the profiles value (a comma-separated list of profiles or a profile expression) is fed into the Spring `Environment.acceptsProfiles()` method.
|
If a document contains a `spring.config.activate.on-profile` key, then the profiles value (a comma-separated list of profiles or a profile expression) is fed into the Spring `Environment.acceptsProfiles()` method.
|
||||||
If the profile expression matches, then that document is included in the final merge (otherwise, it is not), as shown in the following example:
|
If the profile expression matches, then that document is included in the final merge (otherwise, it is not), as shown in the following example:
|
||||||
|
@ -306,4 +306,4 @@ A running application with the Actuator features has a `configprops` endpoint th
|
||||||
|
|
||||||
The appendix includes an xref:appendix:application-properties/index.adoc[`application.properties`] example with a list of the most common properties supported by Spring Boot.
|
The appendix includes an xref:appendix:application-properties/index.adoc[`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`.
|
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 "xref:reference:features/external-config.adoc[Externalized Configuration]".
|
For more about the exact ordering of loading properties, see xref:reference:features/external-config.adoc[].
|
||||||
|
|
|
@ -125,7 +125,7 @@ If you provide any `@Beans` of type `MappingJackson2HttpMessageConverter`, they
|
||||||
Also, a convenience bean of type `HttpMessageConverters` is provided (and is always available if you use the default MVC configuration).
|
Also, a convenience bean of type `HttpMessageConverters` is provided (and is always available if you use the default MVC configuration).
|
||||||
It has some useful methods to access the default and user-enhanced message converters.
|
It has some useful methods to access the default and user-enhanced message converters.
|
||||||
|
|
||||||
See the "`xref:spring-mvc.adoc#howto.spring-mvc.customize-responsebody-rendering[Customize the @ResponseBody Rendering]`" section and the {code-spring-boot-autoconfigure-src}/web/servlet/WebMvcAutoConfiguration.java[`WebMvcAutoConfiguration`] source code for more details.
|
See the xref:spring-mvc.adoc#howto.spring-mvc.customize-responsebody-rendering[] section and the {code-spring-boot-autoconfigure-src}/web/servlet/WebMvcAutoConfiguration.java[`WebMvcAutoConfiguration`] source code for more details.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,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).
|
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 "`xref:reference:web/servlet.adoc#web.servlet.embedded-container.customizing[Customizing Embedded Servlet Containers]`" in the '`Spring Boot Features`' section, or the xref:api:java/org/springframework/boot/autoconfigure/web/ServerProperties.html[`ServerProperties`] class.
|
For more details, see xref:reference:web/servlet.adoc#web.servlet.embedded-container.customizing[Customizing Embedded Servlet Containers] in the '`Spring Boot Features`' section, or the xref:api:java/org/springframework/boot/autoconfigure/web/ServerProperties.html[`ServerProperties`] class.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -294,9 +294,10 @@ Undertow supports `h2c` and `h2` out of the box.
|
||||||
[[howto.webserver.configure]]
|
[[howto.webserver.configure]]
|
||||||
== Configure the Web Server
|
== 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.yaml` file (see "`xref:properties-and-configuration.adoc#howto.properties-and-configuration.discover-build-in-options-for-external-properties[Discover Built-in Options for External Properties]`").
|
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.yaml` file.
|
||||||
|
See xref:properties-and-configuration.adoc#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.
|
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 xref:appendix:application-properties/index.adoc[Common Application Properties].
|
See the list of xref:appendix:application-properties/index.adoc[].
|
||||||
|
|
||||||
The previous sections covered already many common use cases, such as compression, SSL or HTTP/2.
|
The previous sections covered already many common use cases, such as compression, SSL or HTTP/2.
|
||||||
However, if a configuration key does not exist for your use case, you should then look at xref:api:java/org/springframework/boot/web/server/WebServerFactoryCustomizer.html[`WebServerFactoryCustomizer`].
|
However, if a configuration key does not exist for your use case, you should then look at xref:api:java/org/springframework/boot/web/server/WebServerFactoryCustomizer.html[`WebServerFactoryCustomizer`].
|
||||||
|
@ -345,8 +346,8 @@ When you do so, auto-configured customizers are still applied on your custom fac
|
||||||
|
|
||||||
In a servlet stack application, that is with the `spring-boot-starter-web`, there are two ways to add `Servlet`, `Filter`, `ServletContextListener`, and the other listeners supported by the Servlet API to your application:
|
In a servlet stack application, that is with the `spring-boot-starter-web`, there are two ways to add `Servlet`, `Filter`, `ServletContextListener`, and the other listeners supported by the Servlet API to your application:
|
||||||
|
|
||||||
* xref:webserver.adoc#howto.webserver.add-servlet-filter-listener.spring-bean[Add a Servlet, Filter, or Listener by Using a Spring Bean]
|
* xref:webserver.adoc#howto.webserver.add-servlet-filter-listener.spring-bean[]
|
||||||
* xref:webserver.adoc#howto.webserver.add-servlet-filter-listener.using-scanning[Add Servlets, Filters, and Listeners by Using Classpath Scanning]
|
* xref:webserver.adoc#howto.webserver.add-servlet-filter-listener.using-scanning[]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -367,7 +368,7 @@ If no `dispatcherType` is specified on a filter registration, `REQUEST` is used.
|
||||||
This aligns with the servlet specification's default dispatcher type.
|
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 "`xref:reference:web/servlet.adoc#web.servlet.embedded-container.servlets-filters-listeners.beans[Registering Servlets, Filters, and Listeners as Spring Beans]`" section.
|
Like any other Spring bean, you can define the order of servlet filter beans; please make sure to check the xref:reference:web/servlet.adoc#web.servlet.embedded-container.servlets-filters-listeners.beans[] section.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
= Enabling Production-ready Features
|
= Enabling Production-ready Features
|
||||||
|
|
||||||
The {code-spring-boot}/spring-boot-project/spring-boot-actuator[`spring-boot-actuator`] module provides all of Spring Boot's production-ready features.
|
The {code-spring-boot}/spring-boot-project/spring-boot-actuator[`spring-boot-actuator`] module provides all of Spring Boot's production-ready features.
|
||||||
The recommended way to enable the features is to add a dependency on the `spring-boot-starter-actuator` "`Starter`".
|
The recommended way to enable the features is to add a dependency on the `spring-boot-starter-actuator` starter.
|
||||||
|
|
||||||
.Definition of Actuator
|
.Definition of Actuator
|
||||||
****
|
****
|
||||||
|
@ -10,7 +10,7 @@ An actuator is a manufacturing term that refers to a mechanical device for movin
|
||||||
Actuators can generate a large amount of motion from a small change.
|
Actuators can generate a large amount of motion from a small change.
|
||||||
****
|
****
|
||||||
|
|
||||||
To add the actuator to a Maven-based project, add the following "`Starter`" dependency:
|
To add the actuator to a Maven-based project, add the following starter dependency:
|
||||||
|
|
||||||
[source,xml]
|
[source,xml]
|
||||||
----
|
----
|
||||||
|
|
|
@ -294,7 +294,7 @@ Information returned by the `/env`, `/configprops` and `/quartz` endpoints can b
|
||||||
Values can only be viewed in an unsanitized form when:
|
Values can only be viewed in an unsanitized form when:
|
||||||
|
|
||||||
- The `show-values` property has been set to something other than `NEVER`
|
- The `show-values` property has been set to something other than `NEVER`
|
||||||
- No custom `xref:how-to:actuator.adoc#howto.actuator.customizing-sanitization[SanitizingFunction]` beans apply
|
- No custom xref:how-to:actuator.adoc#howto.actuator.customizing-sanitization[`SanitizingFunction`] beans apply
|
||||||
|
|
||||||
The `show-values` property can be configured for sanitizable endpoints to one of the following values:
|
The `show-values` property can be configured for sanitizable endpoints to one of the following values:
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ management:
|
||||||
roles: "admin"
|
roles: "admin"
|
||||||
----
|
----
|
||||||
|
|
||||||
NOTE: This example assumes that no `xref:how-to:actuator.adoc#howto.actuator.customizing-sanitization[SanitizingFunction]` beans have been defined.
|
NOTE: This example assumes that no xref:how-to:actuator.adoc#howto.actuator.customizing-sanitization[`SanitizingFunction`] beans have been defined.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -908,7 +908,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].
|
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 calls those probes and reacts to the result.
|
Depending on https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/[your Kubernetes configuration], the kubelet calls those probes and reacts to the result.
|
||||||
|
|
||||||
By default, Spring Boot manages your xref:features/spring-application.adoc#features.spring-application.application-availability[Application Availability State].
|
By default, Spring Boot manages your xref:features/spring-application.adoc#features.spring-application.application-availability[Application Availability] state.
|
||||||
If deployed in a Kubernetes environment, actuator gathers the "`Liveness`" and "`Readiness`" information from the `ApplicationAvailability` interface and uses that information in dedicated xref:actuator/endpoints.adoc#actuator.endpoints.health.auto-configured-health-indicators[health indicators]: `LivenessStateHealthIndicator` and `ReadinessStateHealthIndicator`.
|
If deployed in a Kubernetes environment, actuator gathers the "`Liveness`" and "`Readiness`" information from the `ApplicationAvailability` interface and uses that information in dedicated xref:actuator/endpoints.adoc#actuator.endpoints.health.auto-configured-health-indicators[health indicators]: `LivenessStateHealthIndicator` and `ReadinessStateHealthIndicator`.
|
||||||
These indicators are shown on the global health endpoint (`"/actuator/health"`).
|
These indicators are shown on the global health endpoint (`"/actuator/health"`).
|
||||||
They are also exposed as separate HTTP Probes by using xref:actuator/endpoints.adoc#actuator.endpoints.health.groups[health groups]: `"/actuator/health/liveness"` and `"/actuator/health/readiness"`.
|
They are also exposed as separate HTTP Probes by using xref:actuator/endpoints.adoc#actuator.endpoints.health.groups[health groups]: `"/actuator/health/liveness"` and `"/actuator/health/readiness"`.
|
||||||
|
@ -1062,7 +1062,7 @@ When a Spring Boot application shuts down:
|
||||||
|The application context is closed and the application is shut down.
|
|The application context is closed and the application is shut down.
|
||||||
|===
|
|===
|
||||||
|
|
||||||
TIP: See xref:how-to:deployment/cloud.adoc#howto.deployment.cloud.kubernetes.container-lifecycle[Kubernetes container lifecycle section] for more information about Kubernetes deployment.
|
TIP: See xref:how-to:deployment/cloud.adoc#howto.deployment.cloud.kubernetes.container-lifecycle[] for more information about Kubernetes deployment.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1170,7 +1170,7 @@ Another useful feature of the `info` endpoint is its ability to publish informat
|
||||||
If a `GitProperties` bean is available, you can use the `info` endpoint to expose these properties.
|
If a `GitProperties` bean is available, you can use the `info` endpoint to expose these properties.
|
||||||
|
|
||||||
TIP: A `GitProperties` bean is auto-configured if a `git.properties` file is available at the root of the classpath.
|
TIP: A `GitProperties` bean is auto-configured if a `git.properties` file is available at the root of the classpath.
|
||||||
See "xref:how-to:build.adoc#howto.build.generate-git-info[how to generate git information]" for more detail.
|
See xref:how-to:build.adoc#howto.build.generate-git-info[] for more detail.
|
||||||
|
|
||||||
By default, the endpoint exposes `git.branch`, `git.commit.id`, and `git.commit.time` properties, if present.
|
By default, the endpoint exposes `git.branch`, `git.commit.id`, and `git.commit.time` properties, if present.
|
||||||
If you do not want any of these properties in the endpoint response, they need to be excluded from the `git.properties` file.
|
If you do not want any of these properties in the endpoint response, they need to be excluded from the `git.properties` file.
|
||||||
|
@ -1203,7 +1203,7 @@ If a `BuildProperties` bean is available, the `info` endpoint can also publish i
|
||||||
This happens if a `META-INF/build-info.properties` file is available in the classpath.
|
This happens if a `META-INF/build-info.properties` file is available in the classpath.
|
||||||
|
|
||||||
TIP: The Maven and Gradle plugins can both generate that file.
|
TIP: The Maven and Gradle plugins can both generate that file.
|
||||||
See "xref:how-to:build.adoc#howto.build.generate-info[how to generate build information]" for more details.
|
See xref:how-to:build.adoc#howto.build.generate-info[] for more details.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,25 +3,25 @@
|
||||||
|
|
||||||
Spring Boot Actuator provides dependency management and auto-configuration for {url-micrometer-site}[Micrometer], an application metrics facade that supports {url-micrometer-docs}[numerous monitoring systems], including:
|
Spring Boot Actuator provides dependency management and auto-configuration for {url-micrometer-site}[Micrometer], an application metrics facade that supports {url-micrometer-docs}[numerous monitoring systems], including:
|
||||||
|
|
||||||
- xref:actuator/metrics.adoc#actuator.metrics.export.appoptics[AppOptics]
|
- xref:actuator/metrics.adoc#actuator.metrics.export.appoptics[]
|
||||||
- xref:actuator/metrics.adoc#actuator.metrics.export.atlas[Atlas]
|
- xref:actuator/metrics.adoc#actuator.metrics.export.atlas[]
|
||||||
- xref:actuator/metrics.adoc#actuator.metrics.export.datadog[Datadog]
|
- xref:actuator/metrics.adoc#actuator.metrics.export.datadog[]
|
||||||
- xref:actuator/metrics.adoc#actuator.metrics.export.dynatrace[Dynatrace]
|
- xref:actuator/metrics.adoc#actuator.metrics.export.dynatrace[]
|
||||||
- xref:actuator/metrics.adoc#actuator.metrics.export.elastic[Elastic]
|
- xref:actuator/metrics.adoc#actuator.metrics.export.elastic[]
|
||||||
- xref:actuator/metrics.adoc#actuator.metrics.export.ganglia[Ganglia]
|
- xref:actuator/metrics.adoc#actuator.metrics.export.ganglia[]
|
||||||
- xref:actuator/metrics.adoc#actuator.metrics.export.graphite[Graphite]
|
- xref:actuator/metrics.adoc#actuator.metrics.export.graphite[]
|
||||||
- xref:actuator/metrics.adoc#actuator.metrics.export.humio[Humio]
|
- xref:actuator/metrics.adoc#actuator.metrics.export.humio[]
|
||||||
- xref:actuator/metrics.adoc#actuator.metrics.export.influx[Influx]
|
- xref:actuator/metrics.adoc#actuator.metrics.export.influx[]
|
||||||
- xref:actuator/metrics.adoc#actuator.metrics.export.jmx[JMX]
|
- xref:actuator/metrics.adoc#actuator.metrics.export.jmx[]
|
||||||
- xref:actuator/metrics.adoc#actuator.metrics.export.kairos[KairosDB]
|
- xref:actuator/metrics.adoc#actuator.metrics.export.kairos[]
|
||||||
- xref:actuator/metrics.adoc#actuator.metrics.export.newrelic[New Relic]
|
- xref:actuator/metrics.adoc#actuator.metrics.export.newrelic[]
|
||||||
- xref:actuator/metrics.adoc#actuator.metrics.export.otlp[OpenTelemetry]
|
- xref:actuator/metrics.adoc#actuator.metrics.export.otlp[]
|
||||||
- xref:actuator/metrics.adoc#actuator.metrics.export.prometheus[Prometheus]
|
- xref:actuator/metrics.adoc#actuator.metrics.export.prometheus[]
|
||||||
- xref:actuator/metrics.adoc#actuator.metrics.export.signalfx[SignalFx]
|
- xref:actuator/metrics.adoc#actuator.metrics.export.signalfx[]
|
||||||
- xref:actuator/metrics.adoc#actuator.metrics.export.simple[Simple (in-memory)]
|
- xref:actuator/metrics.adoc#actuator.metrics.export.simple[] (in-memory)
|
||||||
- xref:actuator/metrics.adoc#actuator.metrics.export.stackdriver[Stackdriver]
|
- xref:actuator/metrics.adoc#actuator.metrics.export.stackdriver[]
|
||||||
- xref:actuator/metrics.adoc#actuator.metrics.export.statsd[StatsD]
|
- xref:actuator/metrics.adoc#actuator.metrics.export.statsd[D]
|
||||||
- xref:actuator/metrics.adoc#actuator.metrics.export.wavefront[Wavefront]
|
- xref:actuator/metrics.adoc#actuator.metrics.export.wavefront[]
|
||||||
|
|
||||||
TIP: To learn more about Micrometer's capabilities, see its {url-micrometer-docs}[reference documentation], in particular the {url-micrometer-docs-concepts}[concepts section].
|
TIP: To learn more about Micrometer's capabilities, see its {url-micrometer-docs}[reference documentation], in particular the {url-micrometer-docs-concepts}[concepts section].
|
||||||
|
|
||||||
|
@ -1236,7 +1236,7 @@ configurable buffer length.
|
||||||
| Publish a cumulative histogram with buckets defined by your service-level objectives.
|
| Publish a cumulative histogram with buckets defined by your service-level objectives.
|
||||||
|===
|
|===
|
||||||
|
|
||||||
For more details on the concepts behind `percentiles-histogram`, `percentiles`, and `slo`, see the {url-micrometer-docs-concepts}#_histograms_and_percentiles["`Histograms and percentiles`" section] of the Micrometer documentation.
|
For more details on the concepts behind `percentiles-histogram`, `percentiles`, and `slo`, see the {url-micrometer-docs-concepts}#_histograms_and_percentiles[Histograms and percentiles] section of the Micrometer documentation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@ In the `spring-boot` module, you can find two classes to create files that are o
|
||||||
|
|
||||||
By default, these writers are not activated, but you can enable them:
|
By default, these writers are not activated, but you can enable them:
|
||||||
|
|
||||||
* xref:actuator/process-monitoring.adoc#actuator.process-monitoring.configuration[By Extending Configuration]
|
* xref:actuator/process-monitoring.adoc#actuator.process-monitoring.configuration[]
|
||||||
* xref:actuator/process-monitoring.adoc#actuator.process-monitoring.programmatically[Programmatically Enabling Process Monitoring]
|
* xref:actuator/process-monitoring.adoc#actuator.process-monitoring.programmatically[]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ Spring Boot ships auto-configuration for the following tracers:
|
||||||
== Getting Started
|
== Getting Started
|
||||||
|
|
||||||
We need an example application that we can use to get started with tracing.
|
We need an example application that we can use to get started with tracing.
|
||||||
For our purposes, the simple "`Hello World!`" web application that's covered in the "`xref:tutorial:first-application/index.adoc[Developing Your First Spring Boot Application]`" section will suffice.
|
For our purposes, the simple "`Hello World!`" web application that's covered in the xref:tutorial:first-application/index.adoc[] section will suffice.
|
||||||
We're going to use the OpenTelemetry tracer with Zipkin as trace backend.
|
We're going to use the OpenTelemetry tracer with Zipkin as trace backend.
|
||||||
|
|
||||||
To recap, our main application code looks like this:
|
To recap, our main application code looks like this:
|
||||||
|
@ -216,4 +216,4 @@ For the example above, setting this property to `baggage1` results in an MDC ent
|
||||||
== Tests
|
== Tests
|
||||||
|
|
||||||
Tracing components which are reporting data are not auto-configured when using `@SpringBootTest`.
|
Tracing components which are reporting data are not auto-configured when using `@SpringBootTest`.
|
||||||
See xref:testing/spring-boot-applications.adoc#testing.spring-boot-applications.tracing[the testing section] for more details.
|
See xref:testing/spring-boot-applications.adoc#testing.spring-boot-applications.tracing[] for more details.
|
||||||
|
|
|
@ -27,11 +27,11 @@ Spring Boot also provides auto-configuration for the InfluxDB client but it is d
|
||||||
https://redis.io/[Redis] is a cache, message broker, and richly-featured key-value store.
|
https://redis.io/[Redis] is a cache, message broker, and richly-featured key-value store.
|
||||||
Spring Boot offers basic auto-configuration for the https://github.com/lettuce-io/lettuce-core/[Lettuce] and https://github.com/xetorthio/jedis/[Jedis] client libraries and the abstractions on top of them provided by https://github.com/spring-projects/spring-data-redis[Spring Data Redis].
|
Spring Boot offers basic auto-configuration for the https://github.com/lettuce-io/lettuce-core/[Lettuce] and https://github.com/xetorthio/jedis/[Jedis] client libraries and the abstractions on top of them provided by https://github.com/spring-projects/spring-data-redis[Spring Data Redis].
|
||||||
|
|
||||||
There is a `spring-boot-starter-data-redis` "`Starter`" for collecting the dependencies in a convenient way.
|
There is a `spring-boot-starter-data-redis` starter for collecting the dependencies in a convenient way.
|
||||||
By default, it uses https://github.com/lettuce-io/lettuce-core/[Lettuce].
|
By default, it uses https://github.com/lettuce-io/lettuce-core/[Lettuce].
|
||||||
That starter handles both traditional and reactive applications.
|
That starter handles both traditional and reactive applications.
|
||||||
|
|
||||||
TIP: We also provide a `spring-boot-starter-data-redis-reactive` "`Starter`" for consistency with the other stores with reactive support.
|
TIP: We also provide a `spring-boot-starter-data-redis-reactive` starter for consistency with the other stores with reactive support.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ spring:
|
||||||
== MongoDB
|
== MongoDB
|
||||||
|
|
||||||
https://www.mongodb.com/[MongoDB] is an open-source NoSQL document database that uses a JSON-like schema instead of traditional table-based relational data.
|
https://www.mongodb.com/[MongoDB] is an open-source NoSQL document database that uses a JSON-like schema instead of traditional table-based relational data.
|
||||||
Spring Boot offers several conveniences for working with MongoDB, including the `spring-boot-starter-data-mongodb` and `spring-boot-starter-data-mongodb-reactive` "`Starters`".
|
Spring Boot offers several conveniences for working with MongoDB, including the `spring-boot-starter-data-mongodb` and `spring-boot-starter-data-mongodb-reactive` starters.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ As with `JdbcTemplate`, Spring Boot auto-configures a bean for you to inject the
|
||||||
|
|
||||||
include-code::MyBean[]
|
include-code::MyBean[]
|
||||||
|
|
||||||
See the {url-spring-data-mongodb-javadoc}/org/springframework/data/mongodb/core/MongoOperations.html[`MongoOperations` Javadoc] for complete details.
|
See the {url-spring-data-mongodb-javadoc}/org/springframework/data/mongodb/core/MongoOperations.html[`MongoOperations`] API documentation for complete details.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ TIP: For complete details of Spring Data MongoDB, including its rich object mapp
|
||||||
== Neo4j
|
== Neo4j
|
||||||
|
|
||||||
https://neo4j.com/[Neo4j] is an open-source NoSQL graph database that uses a rich data model of nodes connected by first class relationships, which is better suited for connected big data than traditional RDBMS approaches.
|
https://neo4j.com/[Neo4j] is an open-source NoSQL graph database that uses a rich data model of nodes connected by first class relationships, which is better suited for connected big data than traditional RDBMS approaches.
|
||||||
Spring Boot offers several conveniences for working with Neo4j, including the `spring-boot-starter-data-neo4j` "`Starter`".
|
Spring Boot offers several conveniences for working with Neo4j, including the `spring-boot-starter-data-neo4j` starter.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ You could take the JPA example from earlier and define `City` as Spring Data Neo
|
||||||
|
|
||||||
include-code::CityRepository[]
|
include-code::CityRepository[]
|
||||||
|
|
||||||
The `spring-boot-starter-data-neo4j` "`Starter`" enables the repository support as well as transaction management.
|
The `spring-boot-starter-data-neo4j` starter enables the repository support as well as transaction management.
|
||||||
Spring Boot supports both classic and reactive Neo4j repositories, using the `Neo4jTemplate` or `ReactiveNeo4jTemplate` beans.
|
Spring Boot supports both classic and reactive Neo4j repositories, using the `Neo4jTemplate` or `ReactiveNeo4jTemplate` beans.
|
||||||
When Project Reactor is available on the classpath, the reactive style is also auto-configured.
|
When Project Reactor is available on the classpath, the reactive style is also auto-configured.
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ Spring Boot supports several clients:
|
||||||
* The official Java API client
|
* The official Java API client
|
||||||
* The `ReactiveElasticsearchClient` provided by Spring Data Elasticsearch
|
* The `ReactiveElasticsearchClient` provided by Spring Data Elasticsearch
|
||||||
|
|
||||||
Spring Boot provides a dedicated "`Starter`", `spring-boot-starter-data-elasticsearch`.
|
Spring Boot provides a dedicated starter, `spring-boot-starter-data-elasticsearch`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -375,7 +375,7 @@ as shown in the following example:
|
||||||
|
|
||||||
include-code::MyBean[]
|
include-code::MyBean[]
|
||||||
|
|
||||||
In the presence of `spring-data-elasticsearch` and Reactor, Spring Boot can also auto-configure a xref:data/nosql.adoc#data.nosql.elasticsearch.connecting-using-rest.reactiveclient[ReactiveElasticsearchClient] and a `ReactiveElasticsearchTemplate` as beans.
|
In the presence of `spring-data-elasticsearch` and Reactor, Spring Boot can also auto-configure a xref:data/nosql.adoc#data.nosql.elasticsearch.connecting-using-rest.reactiveclient[`ReactiveElasticsearchClient`] and a `ReactiveElasticsearchTemplate` as beans.
|
||||||
They are the reactive equivalent of the other REST clients.
|
They are the reactive equivalent of the other REST clients.
|
||||||
|
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ You can choose to disable the repositories support with the following property:
|
||||||
|
|
||||||
https://cassandra.apache.org/[Cassandra] is an open source, distributed database management system designed to handle large amounts of data across many commodity servers.
|
https://cassandra.apache.org/[Cassandra] is an open source, distributed database management system designed to handle large amounts of data across many commodity servers.
|
||||||
Spring Boot offers auto-configuration for Cassandra and the abstractions on top of it provided by {url-spring-data-cassandra-site}[Spring Data Cassandra].
|
Spring Boot offers auto-configuration for Cassandra and the abstractions on top of it provided by {url-spring-data-cassandra-site}[Spring Data Cassandra].
|
||||||
There is a `spring-boot-starter-data-cassandra` "`Starter`" for collecting the dependencies in a convenient way.
|
There is a `spring-boot-starter-data-cassandra` starter for collecting the dependencies in a convenient way.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -520,7 +520,7 @@ TIP: For complete details of Spring Data Cassandra, see the https://docs.spring.
|
||||||
|
|
||||||
https://www.couchbase.com/[Couchbase] is an open-source, distributed, multi-model NoSQL document-oriented database that is optimized for interactive applications.
|
https://www.couchbase.com/[Couchbase] is an open-source, distributed, multi-model NoSQL document-oriented database that is optimized for interactive applications.
|
||||||
Spring Boot offers auto-configuration for Couchbase and the abstractions on top of it provided by https://github.com/spring-projects/spring-data-couchbase[Spring Data Couchbase].
|
Spring Boot offers auto-configuration for Couchbase and the abstractions on top of it provided by https://github.com/spring-projects/spring-data-couchbase[Spring Data Couchbase].
|
||||||
There are `spring-boot-starter-data-couchbase` and `spring-boot-starter-data-couchbase-reactive` "`Starters`" for collecting the dependencies in a convenient way.
|
There are `spring-boot-starter-data-couchbase` and `spring-boot-starter-data-couchbase-reactive` starters for collecting the dependencies in a convenient way.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -605,14 +605,14 @@ https://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol[LDAP] (Light
|
||||||
Spring Boot offers auto-configuration for any compliant LDAP server as well as support for the embedded in-memory LDAP server from https://ldap.com/unboundid-ldap-sdk-for-java/[UnboundID].
|
Spring Boot offers auto-configuration for any compliant LDAP server as well as support for the embedded in-memory LDAP server from https://ldap.com/unboundid-ldap-sdk-for-java/[UnboundID].
|
||||||
|
|
||||||
LDAP abstractions are provided by https://github.com/spring-projects/spring-data-ldap[Spring Data LDAP].
|
LDAP abstractions are provided by https://github.com/spring-projects/spring-data-ldap[Spring Data LDAP].
|
||||||
There is a `spring-boot-starter-data-ldap` "`Starter`" for collecting the dependencies in a convenient way.
|
There is a `spring-boot-starter-data-ldap` starter for collecting the dependencies in a convenient way.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[[data.nosql.ldap.connecting]]
|
[[data.nosql.ldap.connecting]]
|
||||||
=== Connecting to an LDAP Server
|
=== Connecting to an LDAP Server
|
||||||
|
|
||||||
To connect to an LDAP server, make sure you declare a dependency on the `spring-boot-starter-data-ldap` "`Starter`" or `spring-ldap-core` and then declare the URLs of your server in your application.properties, as shown in the following example:
|
To connect to an LDAP server, make sure you declare a dependency on the `spring-boot-starter-data-ldap` starter or `spring-ldap-core` and then declare the URLs of your server in your application.properties, as shown in the following example:
|
||||||
|
|
||||||
[configprops,yaml]
|
[configprops,yaml]
|
||||||
----
|
----
|
||||||
|
|
|
@ -12,7 +12,7 @@ The {url-spring-framework-site}[Spring Framework] provides extensive support for
|
||||||
Java's `javax.sql.DataSource` interface provides a standard method of working with database connections.
|
Java's `javax.sql.DataSource` interface provides a standard method of working with database connections.
|
||||||
Traditionally, a `DataSource` uses a `URL` along with some credentials to establish a database connection.
|
Traditionally, a `DataSource` uses a `URL` along with some credentials to establish a database connection.
|
||||||
|
|
||||||
TIP: See xref:how-to:data-access.adoc#howto.data-access.configure-custom-datasource[the "`How-to`" section] for more advanced examples, typically to take full control over the configuration of the DataSource.
|
TIP: See the xref:how-to:data-access.adoc#howto.data-access.configure-custom-datasource[] section of the "`How-to Guides`" for more advanced examples, typically to take full control over the configuration of the DataSource.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ It is often convenient to develop applications by using an in-memory embedded da
|
||||||
Obviously, in-memory databases do not provide persistent storage.
|
Obviously, in-memory databases do not provide persistent storage.
|
||||||
You need to populate your database when your application starts and be prepared to throw away data when your application ends.
|
You need to populate your database when your application starts and be prepared to throw away data when your application ends.
|
||||||
|
|
||||||
TIP: The "`How-to`" section includes a xref:how-to:data-initialization.adoc[section on how to initialize a database].
|
TIP: The "`How-to Guides`" section includes a xref:how-to:data-initialization.adoc[section on how to initialize a database].
|
||||||
|
|
||||||
Spring Boot can auto-configure embedded https://www.h2database.com[H2], https://hsqldb.org/[HSQL], and https://db.apache.org/derby/[Derby] databases.
|
Spring Boot can auto-configure embedded https://www.h2database.com[H2], https://hsqldb.org/[HSQL], and https://db.apache.org/derby/[Derby] databases.
|
||||||
You need not provide any connection URLs.
|
You need not provide any connection URLs.
|
||||||
|
@ -93,7 +93,7 @@ If you need to specify a specific class, you can use the configprop:spring.datas
|
||||||
NOTE: For a pooling `DataSource` to be created, we need to be able to verify that a valid `Driver` class is available, so we check for that before doing anything.
|
NOTE: For a pooling `DataSource` to be created, we need to be able to verify that a valid `Driver` class is available, so we check for that before doing anything.
|
||||||
In other words, if you set `spring.datasource.driver-class-name=com.mysql.jdbc.Driver`, then that class has to be loadable.
|
In other words, if you set `spring.datasource.driver-class-name=com.mysql.jdbc.Driver`, then that class has to be loadable.
|
||||||
|
|
||||||
See xref:api:java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.html[`DataSourceProperties`] for more of the supported options.
|
See xref:api:java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.html[`DataSourceProperties`] API documentation for more of the supported options.
|
||||||
These are the standard options that work regardless of xref:data/sql.adoc#data.sql.datasource.connection-pool[the actual implementation].
|
These are the standard options that work regardless of xref:data/sql.adoc#data.sql.datasource.connection-pool[the actual implementation].
|
||||||
It is also possible to fine-tune implementation-specific settings by using their respective prefix (`+spring.datasource.hikari.*+`, `+spring.datasource.tomcat.*+`, `+spring.datasource.dbcp2.*+`, and `+spring.datasource.oracleucp.*+`).
|
It is also possible to fine-tune implementation-specific settings by using their respective prefix (`+spring.datasource.hikari.*+`, `+spring.datasource.tomcat.*+`, `+spring.datasource.dbcp2.*+`, and `+spring.datasource.oracleucp.*+`).
|
||||||
See the documentation of the connection pool implementation you are using for more details.
|
See the documentation of the connection pool implementation you are using for more details.
|
||||||
|
@ -125,7 +125,7 @@ If HikariCP is available, we always choose it.
|
||||||
. Otherwise, if https://commons.apache.org/proper/commons-dbcp/[Commons DBCP2] is available, we use it.
|
. Otherwise, if https://commons.apache.org/proper/commons-dbcp/[Commons DBCP2] is available, we use it.
|
||||||
. If none of HikariCP, Tomcat, and DBCP2 are available and if Oracle UCP is available, we use it.
|
. If none of HikariCP, Tomcat, and DBCP2 are available and if Oracle UCP is available, we use it.
|
||||||
|
|
||||||
NOTE: If you use the `spring-boot-starter-jdbc` or `spring-boot-starter-data-jpa` "`starters`", you automatically get a dependency to `HikariCP`.
|
NOTE: If you use the `spring-boot-starter-jdbc` or `spring-boot-starter-data-jpa` starters, you automatically get a dependency to `HikariCP`.
|
||||||
|
|
||||||
You can bypass that algorithm completely and specify the connection pool to use by setting the configprop:spring.datasource.type[] property.
|
You can bypass that algorithm completely and specify the connection pool to use by setting the configprop:spring.datasource.type[] property.
|
||||||
This is especially important if you run your application in a Tomcat container, as `tomcat-jdbc` is provided by default.
|
This is especially important if you run your application in a Tomcat container, as `tomcat-jdbc` is provided by default.
|
||||||
|
@ -208,7 +208,7 @@ It provides the following key dependencies:
|
||||||
* Spring ORM: Core ORM support from the Spring Framework.
|
* Spring ORM: Core ORM support from the Spring Framework.
|
||||||
|
|
||||||
TIP: We do not go into too many details of JPA or {url-spring-data-site}[Spring Data] here.
|
TIP: We do not go into too many details of JPA or {url-spring-data-site}[Spring Data] here.
|
||||||
You can follow the https://spring.io/guides/gs/accessing-data-jpa/["`Accessing Data with JPA`"] guide from https://spring.io and read the {url-spring-data-jpa-site}[Spring Data JPA] and https://hibernate.org/orm/documentation/[Hibernate] reference documentation.
|
You can follow the https://spring.io/guides/gs/accessing-data-jpa/[Accessing Data with JPA] guide from https://spring.io and read the {url-spring-data-jpa-site}[Spring Data JPA] and https://hibernate.org/orm/documentation/[Hibernate] reference documentation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ A typical entity class resembles the following example:
|
||||||
include-code::City[]
|
include-code::City[]
|
||||||
|
|
||||||
TIP: You can customize entity scanning locations by using the `@EntityScan` annotation.
|
TIP: You can customize entity scanning locations by using the `@EntityScan` annotation.
|
||||||
See the "`xref:how-to:data-access.adoc#howto.data-access.separate-entity-definitions-from-spring-configuration[Separate @Entity Definitions from Spring Configuration]`" how-to.
|
See the xref:how-to:data-access.adoc#howto.data-access.separate-entity-definitions-from-spring-configuration[] section of the "`How-to Guides`".
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -485,7 +485,7 @@ TIP: You do not need to specify a driver class name, since Spring Boot obtains t
|
||||||
NOTE: At least the url should be provided.
|
NOTE: At least the url should be provided.
|
||||||
Information specified in the URL takes precedence over individual properties, that is `name`, `username`, `password` and pooling options.
|
Information specified in the URL takes precedence over individual properties, that is `name`, `username`, `password` and pooling options.
|
||||||
|
|
||||||
TIP: The "`How-to`" section includes a xref:how-to:data-initialization.adoc#howto.data-initialization.using-basic-sql-scripts[section on how to initialize a database].
|
TIP: The "`How-to Guides`" section includes a xref:how-to:data-initialization.adoc#howto.data-initialization.using-basic-sql-scripts[section on how to initialize a database].
|
||||||
|
|
||||||
To customize the connections created by a `ConnectionFactory`, that is, set specific parameters that you do not want (or cannot) configure in your central database configuration, you can use a `ConnectionFactoryOptionsBuilderCustomizer` `@Bean`.
|
To customize the connections created by a `ConnectionFactory`, that is, set specific parameters that you do not want (or cannot) configure in your central database configuration, you can use a `ConnectionFactoryOptionsBuilderCustomizer` `@Bean`.
|
||||||
The following example shows how to manually override the database port while the rest of the options are taken from the application configuration:
|
The following example shows how to manually override the database port while the rest of the options are taken from the application configuration:
|
||||||
|
|
|
@ -61,12 +61,12 @@ The `@ConditionalOnMissingBean` annotation is one common example that is used to
|
||||||
Spring Boot includes a number of `@Conditional` annotations that you can reuse in your own code by annotating `@Configuration` classes or individual `@Bean` methods.
|
Spring Boot includes a number of `@Conditional` annotations that you can reuse in your own code by annotating `@Configuration` classes or individual `@Bean` methods.
|
||||||
These annotations include:
|
These annotations include:
|
||||||
|
|
||||||
* xref:features/developing-auto-configuration.adoc#features.developing-auto-configuration.condition-annotations.class-conditions[Class Conditions]
|
* xref:features/developing-auto-configuration.adoc#features.developing-auto-configuration.condition-annotations.class-conditions[]
|
||||||
* xref:features/developing-auto-configuration.adoc#features.developing-auto-configuration.condition-annotations.bean-conditions[Bean Conditions]
|
* xref:features/developing-auto-configuration.adoc#features.developing-auto-configuration.condition-annotations.bean-conditions[]
|
||||||
* xref:features/developing-auto-configuration.adoc#features.developing-auto-configuration.condition-annotations.property-conditions[Property Conditions]
|
* xref:features/developing-auto-configuration.adoc#features.developing-auto-configuration.condition-annotations.property-conditions[]
|
||||||
* xref:features/developing-auto-configuration.adoc#features.developing-auto-configuration.condition-annotations.resource-conditions[Resource Conditions]
|
* xref:features/developing-auto-configuration.adoc#features.developing-auto-configuration.condition-annotations.resource-conditions[]
|
||||||
* xref:features/developing-auto-configuration.adoc#features.developing-auto-configuration.condition-annotations.web-application-conditions[Web Application Conditions]
|
* xref:features/developing-auto-configuration.adoc#features.developing-auto-configuration.condition-annotations.web-application-conditions[]
|
||||||
* xref:features/developing-auto-configuration.adoc#features.developing-auto-configuration.condition-annotations.spel-conditions[SpEL Expression Conditions]
|
* xref:features/developing-auto-configuration.adoc#features.developing-auto-configuration.condition-annotations.spel-conditions[]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ In particular, do not include your keys in the namespaces that Spring Boot uses
|
||||||
If you use the same namespace, we may modify these namespaces in the future in ways that break your modules.
|
If you use the same namespace, we may modify these namespaces in the future in ways that break your modules.
|
||||||
As a rule of thumb, prefix all your keys with a namespace that you own (for example `acme`).
|
As a rule of thumb, prefix all your keys with a namespace that you own (for example `acme`).
|
||||||
|
|
||||||
Make sure that configuration keys are documented by adding field javadoc for each property, as shown in the following example:
|
Make sure that configuration keys are documented by adding field Javadoc for each property, as shown in the following example:
|
||||||
|
|
||||||
include-code::AcmeProperties[]
|
include-code::AcmeProperties[]
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ NOTE: It is recommended to stick with one format for your entire application.
|
||||||
If you have configuration files with both `.properties` and YAML format in the same location, `.properties` takes precedence.
|
If you have configuration files with both `.properties` and YAML format in the same location, `.properties` takes precedence.
|
||||||
|
|
||||||
NOTE: If you use environment variables rather than system properties, most operating systems disallow period-separated key names, but you can use underscores instead (for example, configprop:spring.config.name[format=envvar] instead of configprop:spring.config.name[]).
|
NOTE: If you use environment variables rather than system properties, most operating systems disallow period-separated key names, but you can use underscores instead (for example, configprop:spring.config.name[format=envvar] instead of configprop:spring.config.name[]).
|
||||||
See xref:features/external-config.adoc#features.external-config.typesafe-configuration-properties.relaxed-binding.environment-variables[Binding From Environment Variables] for details.
|
See xref:features/external-config.adoc#features.external-config.typesafe-configuration-properties.relaxed-binding.environment-variables[] for details.
|
||||||
|
|
||||||
NOTE: If your application runs in a servlet container or application server, then JNDI properties (in `java:comp/env`) or servlet context initialization parameters can be used instead of, or as well as, environment variables or system properties.
|
NOTE: If your application runs in a servlet container or application server, then JNDI properties (in `java:comp/env`) or servlet context initialization parameters can be used instead of, or as well as, environment variables or system properties.
|
||||||
|
|
||||||
|
@ -54,7 +54,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.
|
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.
|
You can use these two endpoints to diagnose unexpected property values.
|
||||||
See the "xref:actuator/endpoints.adoc[Production ready features]" section for details.
|
See the xref:actuator/endpoints.adoc[Production ready features] section for details.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ If you have a complex location setup, and you use profile-specific configuration
|
||||||
A location group is a collection of locations that are all considered at the same level.
|
A location group is a collection of locations that are all considered at the same level.
|
||||||
For example, you might want to group all classpath locations, then all external locations.
|
For example, you might want to group all classpath locations, then all external locations.
|
||||||
Items within a location group should be separated with `;`.
|
Items within a location group should be separated with `;`.
|
||||||
See the example in the "`xref:features/external-config.adoc#features.external-config.files.profile-specific[Profile Specific Files]`" section for more details.
|
See the example in the xref:features/external-config.adoc#features.external-config.files.profile-specific[] section for more details.
|
||||||
|
|
||||||
Locations configured by using `spring.config.location` replace the default locations.
|
Locations configured by using `spring.config.location` replace the default locations.
|
||||||
For example, if `spring.config.location` is configured with the value `optional:classpath:/custom-config/,optional:file:./custom-config/`, the complete set of locations considered is:
|
For example, if `spring.config.location` is configured with the value `optional:classpath:/custom-config/,optional:file:./custom-config/`, the complete set of locations considered is:
|
||||||
|
@ -325,7 +325,7 @@ The example above would import both `my.properties` as well as any `my-<profile>
|
||||||
[TIP]
|
[TIP]
|
||||||
====
|
====
|
||||||
Spring Boot includes pluggable API that allows various different location addresses to be supported.
|
Spring Boot includes pluggable API that allows various different location addresses to be supported.
|
||||||
By default you can import Java Properties, YAML and "`xref:features/external-config.adoc#features.external-config.files.configtree[configuration trees]`".
|
By default you can import Java Properties, YAML and xref:features/external-config.adoc#features.external-config.files.configtree[configuration trees].
|
||||||
|
|
||||||
Third-party jars can offer support for additional technologies (there is no requirement for files to be local).
|
Third-party jars can offer support for additional technologies (there is no requirement for files to be local).
|
||||||
For example, you can imagine config data being from external stores such as Consul, Apache ZooKeeper or Netflix Archaius.
|
For example, you can imagine config data being from external stores such as Consul, Apache ZooKeeper or Netflix Archaius.
|
||||||
|
@ -479,7 +479,7 @@ If you used `${demo.itemPrice}` instead, `demo.item-price` and `DEMO_ITEMPRICE`
|
||||||
====
|
====
|
||||||
|
|
||||||
TIP: You can also use this technique to create "`short`" variants of existing Spring Boot properties.
|
TIP: You can also use this technique to create "`short`" variants of existing Spring Boot properties.
|
||||||
See the _xref:how-to:properties-and-configuration.adoc#howto.properties-and-configuration.short-command-line-arguments[Use '`Short`' Command Line Arguments]_ how-to for details.
|
See the xref:how-to:properties-and-configuration.adoc#howto.properties-and-configuration.short-command-line-arguments[] section in "`How-to Guides`" for details.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -573,7 +573,7 @@ myotherprop: "sometimes-set"
|
||||||
|
|
||||||
Spring Boot does not provide any built-in support for encrypting property values, however, it does provide the hook points necessary to modify values contained in the Spring `Environment`.
|
Spring Boot does not provide any built-in support for encrypting property values, however, it does provide the hook points necessary to modify values contained in the Spring `Environment`.
|
||||||
The `EnvironmentPostProcessor` interface allows you to manipulate the `Environment` before the application starts.
|
The `EnvironmentPostProcessor` interface allows you to manipulate the `Environment` before the application starts.
|
||||||
See xref:how-to:application.adoc#howto.application.customize-the-environment-or-application-context[Customize the Environment or ApplicationContext Before It Starts] for details.
|
See xref:how-to:application.adoc#howto.application.customize-the-environment-or-application-context[] for details.
|
||||||
|
|
||||||
If you need a secure way to store credentials and passwords, the https://cloud.spring.io/spring-cloud-vault/[Spring Cloud Vault] project provides support for storing externalized configuration in https://www.vaultproject.io/[HashiCorp Vault].
|
If you need a secure way to store credentials and passwords, the https://cloud.spring.io/spring-cloud-vault/[Spring Cloud Vault] project provides support for storing externalized configuration in https://www.vaultproject.io/[HashiCorp Vault].
|
||||||
|
|
||||||
|
@ -585,7 +585,7 @@ If you need a secure way to store credentials and passwords, the https://cloud.s
|
||||||
https://yaml.org[YAML] is a superset of JSON and, as such, is a convenient format for specifying hierarchical configuration data.
|
https://yaml.org[YAML] is a superset of JSON and, as such, is a convenient format for specifying hierarchical configuration data.
|
||||||
The `SpringApplication` class automatically supports YAML as an alternative to properties whenever you have the https://github.com/snakeyaml/snakeyaml[SnakeYAML] library on your classpath.
|
The `SpringApplication` class automatically supports YAML as an alternative to properties whenever you have the https://github.com/snakeyaml/snakeyaml[SnakeYAML] library on your classpath.
|
||||||
|
|
||||||
NOTE: If you use "`Starters`", SnakeYAML is automatically provided by `spring-boot-starter`.
|
NOTE: If you use starters, SnakeYAML is automatically provided by `spring-boot-starter`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -637,7 +637,7 @@ my.servers[1]=another.example.com
|
||||||
----
|
----
|
||||||
|
|
||||||
TIP: Properties that use the `[index]` notation can be bound to Java `List` or `Set` objects using Spring Boot's `Binder` class.
|
TIP: Properties that use the `[index]` notation can be bound to Java `List` or `Set` objects using Spring Boot's `Binder` class.
|
||||||
For more details see the "`xref:features/external-config.adoc#features.external-config.typesafe-configuration-properties[Type-safe Configuration Properties]`" section below.
|
For more details see the xref:features/external-config.adoc#features.external-config.typesafe-configuration-properties[] section below.
|
||||||
|
|
||||||
WARNING: YAML files cannot be loaded by using the `@PropertySource` or `@TestPropertySource` annotations.
|
WARNING: YAML files cannot be loaded by using the `@PropertySource` or `@TestPropertySource` annotations.
|
||||||
So, in the case that you need to load values that way, you need to use a properties file.
|
So, in the case that you need to load values that way, you need to use a properties file.
|
||||||
|
@ -892,8 +892,8 @@ NOTE: The `prefix` value for the annotation _must_ be in kebab case (lowercase a
|
||||||
| Standard YAML list syntax or comma-separated values
|
| Standard YAML list syntax or comma-separated values
|
||||||
|
|
||||||
| Environment Variables
|
| Environment Variables
|
||||||
| Upper case format with underscore as the delimiter (see xref:features/external-config.adoc#features.external-config.typesafe-configuration-properties.relaxed-binding.environment-variables[Binding From Environment Variables]).
|
| Upper case format with underscore as the delimiter (see xref:features/external-config.adoc#features.external-config.typesafe-configuration-properties.relaxed-binding.environment-variables[]).
|
||||||
| Numeric values surrounded by underscores (see xref:features/external-config.adoc#features.external-config.typesafe-configuration-properties.relaxed-binding.environment-variables[Binding From Environment Variables])
|
| Numeric values surrounded by underscores (see xref:features/external-config.adoc#features.external-config.typesafe-configuration-properties.relaxed-binding.environment-variables[])
|
||||||
|
|
||||||
| System properties
|
| System properties
|
||||||
| Camel case, kebab case, or underscore notation
|
| Camel case, kebab case, or underscore notation
|
||||||
|
@ -1190,7 +1190,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.
|
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.
|
Point your web browser to `/actuator/configprops` or use the equivalent JMX endpoint.
|
||||||
See the "xref:actuator/endpoints.adoc[Production ready features]" section for details.
|
See the xref:actuator/endpoints.adoc[Production ready features] section for details.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
|
|
||||||
This section dives into the details of Spring Boot.
|
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.
|
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 "xref:tutorial:index.adoc[Tutorial]" and "xref:using/index.adoc[Developing with Spring Boot]" sections, so that you have a good grounding of the basics.
|
If you have not already done so, you might want to read the xref:tutorial:index.adoc[] and xref:using/index.adoc[] sections, so that you have a good grounding of the basics.
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ All `@JsonComponent` beans in the `ApplicationContext` are automatically registe
|
||||||
Because `@JsonComponent` is meta-annotated with `@Component`, the usual component-scanning rules apply.
|
Because `@JsonComponent` is meta-annotated with `@Component`, the usual component-scanning rules apply.
|
||||||
|
|
||||||
Spring Boot also provides xref:api:java/org/springframework/boot/jackson/JsonObjectSerializer.html[`JsonObjectSerializer`] and xref:api:java/org/springframework/boot/jackson/JsonObjectDeserializer.html[`JsonObjectDeserializer`] base classes that provide useful alternatives to the standard Jackson versions when serializing objects.
|
Spring Boot also provides xref:api:java/org/springframework/boot/jackson/JsonObjectSerializer.html[`JsonObjectSerializer`] and xref:api:java/org/springframework/boot/jackson/JsonObjectDeserializer.html[`JsonObjectDeserializer`] base classes that provide useful alternatives to the standard Jackson versions when serializing objects.
|
||||||
See xref:api:java/org/springframework/boot/jackson/JsonObjectSerializer.html[`JsonObjectSerializer`] and xref:api:java/org/springframework/boot/jackson/JsonObjectDeserializer.html[`JsonObjectDeserializer`] in the Javadoc for details.
|
See xref:api:java/org/springframework/boot/jackson/JsonObjectSerializer.html[`JsonObjectSerializer`] and xref:api:java/org/springframework/boot/jackson/JsonObjectDeserializer.html[`JsonObjectDeserializer`] in the API documentation for details.
|
||||||
|
|
||||||
The example above can be rewritten to use `JsonObjectSerializer`/`JsonObjectDeserializer` as follows:
|
The example above can be rewritten to use `JsonObjectSerializer`/`JsonObjectDeserializer` as follows:
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ Spring Boot uses https://commons.apache.org/logging[Commons Logging] for all int
|
||||||
Default configurations are provided for {apiref-openjdk}/java.logging/java/util/logging/package-summary.html[Java Util Logging], https://logging.apache.org/log4j/2.x/[Log4j2], and https://logback.qos.ch/[Logback].
|
Default configurations are provided for {apiref-openjdk}/java.logging/java/util/logging/package-summary.html[Java Util Logging], https://logging.apache.org/log4j/2.x/[Log4j2], and https://logback.qos.ch/[Logback].
|
||||||
In each case, loggers are pre-configured to use console output with optional file output also available.
|
In each case, loggers are pre-configured to use console output with optional file output also available.
|
||||||
|
|
||||||
By default, if you use the "`Starters`", Logback is used for logging.
|
By default, if you use the starters, Logback is used for logging.
|
||||||
Appropriate Logback routing is also included to ensure that dependent libraries that use Java Util Logging, Commons Logging, Log4J, or SLF4J all work correctly.
|
Appropriate Logback routing is also included to ensure that dependent libraries that use Java Util Logging, Commons Logging, Log4J, or SLF4J all work correctly.
|
||||||
|
|
||||||
TIP: There are a lot of logging frameworks available for Java.
|
TIP: There are a lot of logging frameworks available for Java.
|
||||||
|
|
|
@ -64,7 +64,7 @@ This means that you can specify active profiles in `application.properties` and
|
||||||
Sometimes, it is useful to have properties that *add* to the active profiles rather than replace them.
|
Sometimes, it is useful to have properties that *add* to the active profiles rather than replace them.
|
||||||
The `spring.profiles.include` property can be used to add active profiles on top of those activated by the configprop:spring.profiles.active[] property.
|
The `spring.profiles.include` property can be used to add active profiles on top of those activated by the configprop:spring.profiles.active[] property.
|
||||||
The `SpringApplication` entry point also has a Java API for setting additional profiles.
|
The `SpringApplication` entry point also has a Java API for setting additional profiles.
|
||||||
See the `setAdditionalProfiles()` method in xref:api:java/org/springframework/boot/SpringApplication.html[SpringApplication].
|
See the `setAdditionalProfiles()` method in xref:api:java/org/springframework/boot/SpringApplication.html[`SpringApplication`].
|
||||||
|
|
||||||
For example, when an application with the following properties is run, the common and local profiles will be activated even when it runs using the `--spring.profiles.active` switch:
|
For example, when an application with the following properties is run, the common and local profiles will be activated even when it runs using the `--spring.profiles.active` switch:
|
||||||
|
|
||||||
|
@ -123,4 +123,4 @@ It is also possible to activate profiles by using Spring's `ConfigurableEnvironm
|
||||||
== Profile-specific Configuration Files
|
== Profile-specific Configuration Files
|
||||||
|
|
||||||
Profile-specific variants of both `application.properties` (or `application.yaml`) and files referenced through `@ConfigurationProperties` are considered as files and loaded.
|
Profile-specific variants of both `application.properties` (or `application.yaml`) and files referenced through `@ConfigurationProperties` are considered as files and loaded.
|
||||||
See "xref:features/external-config.adoc#features.external-config.files.profile-specific[Profile Specific Files]" for details.
|
See xref:features/external-config.adoc#features.external-config.files.profile-specific[] for details.
|
||||||
|
|
|
@ -16,7 +16,7 @@ include::ROOT:partial$application/spring-application.txt[]
|
||||||
|
|
||||||
|
|
||||||
By default, `INFO` logging messages are shown, including some relevant startup details, such as the user that launched the application.
|
By default, `INFO` logging messages are shown, including some relevant startup details, such as the user that launched the application.
|
||||||
If you need a log level other than `INFO`, you can set it, as described in xref:features/logging.adoc#features.logging.log-levels[Log Levels].
|
If you need a log level other than `INFO`, you can set it, as described in xref:features/logging.adoc#features.logging.log-levels[].
|
||||||
The application version is determined using the implementation version from the main application class's package.
|
The application version is determined using the implementation version from the main application class's package.
|
||||||
Startup information logging can be turned off by setting `spring.main.log-startup-info` to `false`.
|
Startup information logging can be turned off by setting `spring.main.log-startup-info` to `false`.
|
||||||
This will also turn off logging of the application's active profiles.
|
This will also turn off logging of the application's active profiles.
|
||||||
|
@ -155,16 +155,16 @@ NOTE: The constructor arguments passed to `SpringApplication` are configuration
|
||||||
In most cases, these are references to `@Configuration` classes, but they could also be direct references `@Component` classes.
|
In most cases, these are references to `@Configuration` classes, but they could also be direct references `@Component` classes.
|
||||||
|
|
||||||
It is also possible to configure the `SpringApplication` by using an `application.properties` file.
|
It is also possible to configure the `SpringApplication` by using an `application.properties` file.
|
||||||
See _xref:features/external-config.adoc[Externalized Configuration]_ for details.
|
See xref:features/external-config.adoc[] for details.
|
||||||
|
|
||||||
For a complete list of the configuration options, see the xref:api:java/org/springframework/boot/SpringApplication.html[`SpringApplication` Javadoc].
|
For a complete list of the configuration options, see the xref:api:java/org/springframework/boot/SpringApplication.html[`SpringApplication`] API documentation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[[features.spring-application.fluent-builder-api]]
|
[[features.spring-application.fluent-builder-api]]
|
||||||
== Fluent Builder API
|
== Fluent Builder API
|
||||||
|
|
||||||
If you need to build an `ApplicationContext` hierarchy (multiple contexts with a parent/child relationship) or if you prefer using a "`fluent`" builder API, you can use the `SpringApplicationBuilder`.
|
If you need to build an `ApplicationContext` hierarchy (multiple contexts with a parent/child relationship) or if you prefer using a fluent builder API, you can use the `SpringApplicationBuilder`.
|
||||||
|
|
||||||
The `SpringApplicationBuilder` lets you chain together multiple method calls and includes `parent` and `child` methods that let you create a hierarchy, as shown in the following example:
|
The `SpringApplicationBuilder` lets you chain together multiple method calls and includes `parent` and `child` methods that let you create a hierarchy, as shown in the following example:
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ include-code::MyApplication[tag=*]
|
||||||
|
|
||||||
NOTE: There are some restrictions when creating an `ApplicationContext` hierarchy.
|
NOTE: There are some restrictions when creating an `ApplicationContext` hierarchy.
|
||||||
For example, Web components *must* be contained within the child context, and the same `Environment` is used for both parent and child contexts.
|
For example, Web components *must* be contained within the child context, and the same `Environment` is used for both parent and child contexts.
|
||||||
See the xref:api:java/org/springframework/boot/builder/SpringApplicationBuilder.html[`SpringApplicationBuilder` Javadoc] for full details.
|
See the xref:api:java/org/springframework/boot/builder/SpringApplicationBuilder.html[`SpringApplicationBuilder`] API documentation for full details.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -193,7 +193,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 is currently failing.
|
The "`Liveness`" state of an application tells whether its internal state allows it to work correctly, or recover by itself if it is 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.
|
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 xref:actuator/endpoints.adoc#actuator.endpoints.health[Health checks].
|
NOTE: In general, the "Liveness" state should not be based on external checks, such as xref:actuator/endpoints.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.
|
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`.
|
The internal state of Spring Boot applications is mostly represented by the Spring `ApplicationContext`.
|
||||||
|
|
|
@ -38,22 +38,22 @@ The cache abstraction does not provide an actual store and relies on abstraction
|
||||||
|
|
||||||
If you have not defined a bean of type `CacheManager` or a `CacheResolver` named `cacheResolver` (see {url-spring-framework-javadoc}/org/springframework/cache/annotation/CachingConfigurer.html[`CachingConfigurer`]), Spring Boot tries to detect the following providers (in the indicated order):
|
If you have not defined a bean of type `CacheManager` or a `CacheResolver` named `cacheResolver` (see {url-spring-framework-javadoc}/org/springframework/cache/annotation/CachingConfigurer.html[`CachingConfigurer`]), Spring Boot tries to detect the following providers (in the indicated order):
|
||||||
|
|
||||||
. xref:io/caching.adoc#io.caching.provider.generic[Generic]
|
. xref:io/caching.adoc#io.caching.provider.generic[]
|
||||||
. xref:io/caching.adoc#io.caching.provider.jcache[JCache (JSR-107)] (EhCache 3, Hazelcast, Infinispan, and others)
|
. xref:io/caching.adoc#io.caching.provider.jcache[] (EhCache 3, Hazelcast, Infinispan, and others)
|
||||||
. xref:io/caching.adoc#io.caching.provider.hazelcast[Hazelcast]
|
. xref:io/caching.adoc#io.caching.provider.hazelcast[]
|
||||||
. xref:io/caching.adoc#io.caching.provider.infinispan[Infinispan]
|
. xref:io/caching.adoc#io.caching.provider.infinispan[]
|
||||||
. xref:io/caching.adoc#io.caching.provider.couchbase[Couchbase]
|
. xref:io/caching.adoc#io.caching.provider.couchbase[]
|
||||||
. xref:io/caching.adoc#io.caching.provider.redis[Redis]
|
. xref:io/caching.adoc#io.caching.provider.redis[]
|
||||||
. xref:io/caching.adoc#io.caching.provider.caffeine[Caffeine]
|
. xref:io/caching.adoc#io.caching.provider.caffeine[]
|
||||||
. xref:io/caching.adoc#io.caching.provider.cache2k[Cache2k]
|
. xref:io/caching.adoc#io.caching.provider.cache2k[]
|
||||||
. xref:io/caching.adoc#io.caching.provider.simple[Simple]
|
. xref:io/caching.adoc#io.caching.provider.simple[]
|
||||||
|
|
||||||
Additionally, {url-spring-boot-for-apache-geode-site}[Spring Boot for Apache Geode] provides {url-spring-boot-for-apache-geode-docs}#geode-caching-provider[auto-configuration for using Apache Geode as a cache provider].
|
Additionally, {url-spring-boot-for-apache-geode-site}[Spring Boot for Apache Geode] provides {url-spring-boot-for-apache-geode-docs}#geode-caching-provider[auto-configuration for using Apache Geode as a cache provider].
|
||||||
|
|
||||||
TIP: If the `CacheManager` is auto-configured by Spring Boot, it is possible to _force_ a particular cache provider by setting the configprop:spring.cache.type[] property.
|
TIP: If the `CacheManager` is auto-configured by Spring Boot, it is possible to _force_ a particular cache provider by setting the configprop:spring.cache.type[] property.
|
||||||
Use this property if you need to xref:io/caching.adoc#io.caching.provider.none[use no-op caches] in certain environments (such as tests).
|
Use this property if you need to xref:io/caching.adoc#io.caching.provider.none[use no-op caches] in certain environments (such as tests).
|
||||||
|
|
||||||
TIP: Use the `spring-boot-starter-cache` "`Starter`" to quickly add basic caching dependencies.
|
TIP: Use the `spring-boot-starter-cache` starter to quickly add basic caching dependencies.
|
||||||
The starter brings in `spring-context-support`.
|
The starter brings in `spring-context-support`.
|
||||||
If you add dependencies manually, you must include `spring-context-support` in order to use the JCache or Caffeine support.
|
If you add dependencies manually, you must include `spring-context-support` in order to use the JCache or Caffeine support.
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ A `CacheManager` wrapping all beans of that type is created.
|
||||||
[[io.caching.provider.jcache]]
|
[[io.caching.provider.jcache]]
|
||||||
=== JCache (JSR-107)
|
=== JCache (JSR-107)
|
||||||
|
|
||||||
https://jcp.org/en/jsr/detail?id=107[JCache] is bootstrapped through the presence of a `javax.cache.spi.CachingProvider` on the classpath (that is, a JSR-107 compliant caching library exists on the classpath), and the `JCacheCacheManager` is provided by the `spring-boot-starter-cache` "`Starter`".
|
https://jcp.org/en/jsr/detail?id=107[JCache] is bootstrapped through the presence of a `javax.cache.spi.CachingProvider` on the classpath (that is, a JSR-107 compliant caching library exists on the classpath), and the `JCacheCacheManager` is provided by the `spring-boot-starter-cache` starter.
|
||||||
Various compliant libraries are available, and Spring Boot provides dependency management for Ehcache 3, Hazelcast, and Infinispan.
|
Various compliant libraries are available, and Spring Boot provides dependency management for Ehcache 3, Hazelcast, and Infinispan.
|
||||||
Any other compliant library can be added as well.
|
Any other compliant library can be added as well.
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ include-code::MyRedisCacheManagerConfiguration[]
|
||||||
=== Caffeine
|
=== Caffeine
|
||||||
|
|
||||||
https://github.com/ben-manes/caffeine[Caffeine] is a Java 8 rewrite of Guava's cache that supersedes support for Guava.
|
https://github.com/ben-manes/caffeine[Caffeine] is a Java 8 rewrite of Guava's cache that supersedes support for Guava.
|
||||||
If Caffeine is present, a `CaffeineCacheManager` (provided by the `spring-boot-starter-cache` "`Starter`") is auto-configured.
|
If Caffeine is present, a `CaffeineCacheManager` (provided by the `spring-boot-starter-cache` starter) is auto-configured.
|
||||||
Caches can be created on startup by setting the configprop:spring.cache.cache-names[] property and can be customized by one of the following (in the indicated order):
|
Caches can be created on startup by setting the configprop:spring.cache.cache-names[] property and can be customized by one of the following (in the indicated order):
|
||||||
|
|
||||||
. A cache spec defined by `spring.cache.caffeine.spec`
|
. A cache spec defined by `spring.cache.caffeine.spec`
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[[io.quartz]]
|
[[io.quartz]]
|
||||||
= Quartz Scheduler
|
= Quartz Scheduler
|
||||||
|
|
||||||
Spring Boot offers several conveniences for working with the https://www.quartz-scheduler.org/[Quartz scheduler], including the `spring-boot-starter-quartz` "`Starter`".
|
Spring Boot offers several conveniences for working with the https://www.quartz-scheduler.org/[Quartz scheduler], including the `spring-boot-starter-quartz` starter.
|
||||||
If Quartz is available, a `Scheduler` is auto-configured (through the `SchedulerFactoryBean` abstraction).
|
If Quartz is available, a `Scheduler` is auto-configured (through the `SchedulerFactoryBean` abstraction).
|
||||||
|
|
||||||
Beans of the following types are automatically picked up and associated with the `Scheduler`:
|
Beans of the following types are automatically picked up and associated with the `Scheduler`:
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
The Advanced Message Queuing Protocol (AMQP) is a platform-neutral, wire-level protocol for message-oriented middleware.
|
The Advanced Message Queuing Protocol (AMQP) is a platform-neutral, wire-level protocol for message-oriented middleware.
|
||||||
The Spring AMQP project applies core Spring concepts to the development of AMQP-based messaging solutions.
|
The Spring AMQP project applies core Spring concepts to the development of AMQP-based messaging solutions.
|
||||||
Spring Boot offers several conveniences for working with AMQP through RabbitMQ, including the `spring-boot-starter-amqp` "`Starter`".
|
Spring Boot offers several conveniences for working with AMQP through RabbitMQ, including the `spring-boot-starter-amqp` starter.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ The following component creates a listener endpoint on the `someQueue` destinati
|
||||||
|
|
||||||
include-code::MyBean[]
|
include-code::MyBean[]
|
||||||
|
|
||||||
TIP: See {url-spring-framework-javadoc}/org/springframework/jms/annotation/EnableJms.html[the Javadoc of `@EnableJms`] for more details.
|
TIP: See the {url-spring-framework-javadoc}/org/springframework/jms/annotation/EnableJms.html[`@EnableJms`] API documentation for more details.
|
||||||
|
|
||||||
If you need to create more `JmsListenerContainerFactory` instances or if you want to override the default, Spring Boot provides a `DefaultJmsListenerContainerFactoryConfigurer` that you can use to initialize a `DefaultJmsListenerContainerFactory` with the same settings as the one that is auto-configured.
|
If you need to create more `JmsListenerContainerFactory` instances or if you want to override the default, Spring Boot provides a `DefaultJmsListenerContainerFactoryConfigurer` that you can use to initialize a `DefaultJmsListenerContainerFactory` with the same settings as the one that is auto-configured.
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ The former can be configured using `spring.kafka.streams.application-id`, defaul
|
||||||
The latter can be set globally or specifically overridden only for streams.
|
The latter can be set globally or specifically overridden only for streams.
|
||||||
|
|
||||||
Several additional properties are available using dedicated properties; other arbitrary Kafka properties can be set using the `spring.kafka.streams.properties` namespace.
|
Several additional properties are available using dedicated properties; other arbitrary Kafka properties can be set using the `spring.kafka.streams.properties` namespace.
|
||||||
See also xref:messaging/kafka.adoc#messaging.kafka.additional-properties[Additional Kafka Properties] for more information.
|
See also xref:messaging/kafka.adoc#messaging.kafka.additional-properties[] for more information.
|
||||||
|
|
||||||
To use the factory bean, wire `StreamsBuilder` into your `@Bean` as shown in the following example:
|
To use the factory bean, wire `StreamsBuilder` into your `@Bean` as shown in the following example:
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ You can customize this behavior using the configprop:spring.kafka.streams.auto-s
|
||||||
[[messaging.kafka.additional-properties]]
|
[[messaging.kafka.additional-properties]]
|
||||||
== Additional Kafka Properties
|
== Additional Kafka Properties
|
||||||
|
|
||||||
The properties supported by auto configuration are shown in the xref:appendix:application-properties/index.adoc#appendix.application-properties.integration["`Integration Properties`"] section of the Appendix.
|
The properties supported by auto configuration are shown in the xref:appendix:application-properties/index.adoc#appendix.application-properties.integration[Integration Properties] section of the Appendix.
|
||||||
Note that, for the most part, these properties (hyphenated or camelCase) map directly to the Apache Kafka dotted properties.
|
Note that, for the most part, these properties (hyphenated or camelCase) map directly to the Apache Kafka dotted properties.
|
||||||
See the Apache Kafka documentation for details.
|
See the Apache Kafka documentation for details.
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ https://pulsar.apache.org/[Apache Pulsar] is supported by providing auto-configu
|
||||||
Spring Boot will auto-configure and register the classic (imperative) Spring for Apache Pulsar components when `org.springframework.pulsar:spring-pulsar` is on the classpath.
|
Spring Boot will auto-configure and register the classic (imperative) Spring for Apache Pulsar components when `org.springframework.pulsar:spring-pulsar` is on the classpath.
|
||||||
It will do the same for the reactive components when `org.springframework.pulsar:spring-pulsar-reactive` is on the classpath.
|
It will do the same for the reactive components when `org.springframework.pulsar:spring-pulsar-reactive` is on the classpath.
|
||||||
|
|
||||||
There are `spring-boot-starter-pulsar` and `spring-boot-starter-pulsar-reactive` "`Starters`" for conveniently collecting the dependencies for imperative and reactive use, respectively.
|
There are `spring-boot-starter-pulsar` and `spring-boot-starter-pulsar-reactive` starters for conveniently collecting the dependencies for imperative and reactive use, respectively.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ You can also define a `PulsarAwareTransactionManager` bean if the default auto-c
|
||||||
[[messaging.pulsar.additional-properties]]
|
[[messaging.pulsar.additional-properties]]
|
||||||
== Additional Pulsar Properties
|
== Additional Pulsar Properties
|
||||||
|
|
||||||
The properties supported by auto-configuration are shown in the xref:appendix:application-properties/index.adoc#appendix.application-properties.integration["`Integration Properties`"] section of the Appendix.
|
The properties supported by auto-configuration are shown in the xref:appendix:application-properties/index.adoc#appendix.application-properties.integration[Integration Properties] section of the Appendix.
|
||||||
Note that, for the most part, these properties (hyphenated or camelCase) map directly to the Apache Pulsar configuration properties.
|
Note that, for the most part, these properties (hyphenated or camelCase) map directly to the Apache Pulsar configuration properties.
|
||||||
See the Apache Pulsar documentation for details.
|
See the Apache Pulsar documentation for details.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[[messaging.spring-integration]]
|
[[messaging.spring-integration]]
|
||||||
= Spring Integration
|
= Spring Integration
|
||||||
|
|
||||||
Spring Boot offers several conveniences for working with {url-spring-integration-site}[Spring Integration], including the `spring-boot-starter-integration` "`Starter`".
|
Spring Boot offers several conveniences for working with {url-spring-integration-site}[Spring Integration], including the `spring-boot-starter-integration` starter.
|
||||||
Spring Integration provides abstractions over messaging and also other transports such as HTTP, TCP, and others.
|
Spring Integration provides abstractions over messaging and also other transports such as HTTP, TCP, and others.
|
||||||
If Spring Integration is available on your classpath, it is initialized through the `@EnableIntegration` annotation.
|
If Spring Integration is available on your classpath, it is initialized through the `@EnableIntegration` annotation.
|
||||||
|
|
||||||
|
@ -20,8 +20,8 @@ spring:
|
||||||
initialize-schema: "always"
|
initialize-schema: "always"
|
||||||
----
|
----
|
||||||
|
|
||||||
If `spring-integration-rsocket` is available, developers can configure an RSocket server using `"spring.rsocket.server.*"` properties and let it use `IntegrationRSocketEndpoint` or `RSocketOutboundGateway` components to handle incoming RSocket messages.
|
If `spring-integration-rsocket` is available, developers can configure an RSocket server using `spring.rsocket.server.*` properties and let it use `IntegrationRSocketEndpoint` or `RSocketOutboundGateway` components to handle incoming RSocket messages.
|
||||||
This infrastructure can handle Spring Integration RSocket channel adapters and `@MessageMapping` handlers (given `"spring.integration.rsocket.server.message-mapping-enabled"` is configured).
|
This infrastructure can handle Spring Integration RSocket channel adapters and `@MessageMapping` handlers (given `spring.integration.rsocket.server.message-mapping-enabled` is configured).
|
||||||
|
|
||||||
Spring Boot can also auto-configure an `ClientRSocketConnector` using configuration properties:
|
Spring Boot can also auto-configure an `ClientRSocketConnector` using configuration properties:
|
||||||
|
|
||||||
|
|
|
@ -32,4 +32,4 @@ It implies the following restrictions:
|
||||||
- The Spring `@Profile` annotation and profile-specific configuration xref:how-to:aot.adoc#howto.aot.conditions[have limitations].
|
- The Spring `@Profile` annotation and profile-specific configuration xref:how-to:aot.adoc#howto.aot.conditions[have limitations].
|
||||||
- Properties that change if a bean is created are not supported (for example, `@ConditionalOnProperty` and `.enable` properties).
|
- Properties that change if a bean is created are not supported (for example, `@ConditionalOnProperty` and `.enable` properties).
|
||||||
|
|
||||||
To learn more about ahead-of-time processing, please see the xref:packaging/native-image/introducing-graalvm-native-images.adoc#packaging.native-image.introducing-graalvm-native-images.understanding-aot-processing[Understanding Spring Ahead-of-Time Processing] section.
|
To learn more about ahead-of-time processing, please see the xref:packaging/native-image/introducing-graalvm-native-images.adoc#packaging.native-image.introducing-graalvm-native-images.understanding-aot-processing[] section.
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
|
|
||||||
Spring Boot supports several technologies for optimizing applications for deployment, including xref:packaging/native-image/index.adoc[GraalVM native images], xref:packaging/class-data-sharing.adoc[Class Data Sharing], and xref:packaging/checkpoint-restore.adoc[Checkpoint and Restore].
|
Spring Boot supports several technologies for optimizing applications for deployment, including xref:packaging/native-image/index.adoc[GraalVM native images], xref:packaging/class-data-sharing.adoc[Class Data Sharing], and xref:packaging/checkpoint-restore.adoc[Checkpoint and Restore].
|
||||||
|
|
||||||
Spring Boot applications can be packaged in Docker containers using techniques described in xref:packaging/container-images/index.adoc[Container Images].
|
Spring Boot applications can be packaged in Docker containers using techniques described in xref:packaging/container-images/index.adoc[].
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ This ahead-of-time processing involves statically analyzing your application cod
|
||||||
A GraalVM Native Image is a complete, platform-specific executable.
|
A GraalVM Native Image is a complete, platform-specific executable.
|
||||||
You do not need to ship a Java Virtual Machine in order to run a native image.
|
You do not need to ship a Java Virtual Machine in order to run a native image.
|
||||||
|
|
||||||
TIP: If you just want to get started and experiment with GraalVM you can jump to the xref:how-to:native-image/developing-your-first-application.adoc[Developing Your First GraalVM Native Application] section and return to this section later.
|
TIP: If you just want to get started and experiment with GraalVM you can jump to the xref:how-to:native-image/developing-your-first-application.adoc[] section and return to this section later.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
Spring Boot provides a number of utilities and annotations to help when testing your application.
|
Spring Boot provides a number of utilities and annotations to help when testing your application.
|
||||||
Test support is provided by two modules: `spring-boot-test` contains core items, and `spring-boot-test-autoconfigure` supports auto-configuration for tests.
|
Test support is provided by two modules: `spring-boot-test` contains core items, and `spring-boot-test-autoconfigure` supports auto-configuration for tests.
|
||||||
|
|
||||||
Most developers use the `spring-boot-starter-test` "`Starter`", which imports both Spring Boot test modules as well as JUnit Jupiter, AssertJ, Hamcrest, and a number of other useful libraries.
|
Most developers use the `spring-boot-starter-test` starter, which imports both Spring Boot test modules as well as JUnit Jupiter, AssertJ, Hamcrest, and a number of other useful libraries.
|
||||||
|
|
||||||
[TIP]
|
[TIP]
|
||||||
====
|
====
|
||||||
|
|
|
@ -9,6 +9,6 @@ Often, you need to move beyond unit testing and start integration testing (with
|
||||||
It is useful to be able to perform integration testing without requiring deployment of your application or needing to connect to other infrastructure.
|
It is useful to be able to perform integration testing without requiring deployment of your application or needing to connect to other infrastructure.
|
||||||
|
|
||||||
The Spring Framework includes a dedicated test module for such integration testing.
|
The Spring Framework includes a dedicated test module for such integration testing.
|
||||||
You can declare a dependency directly to `org.springframework:spring-test` or use the `spring-boot-starter-test` "`Starter`" to pull it in transitively.
|
You can declare a dependency directly to `org.springframework:spring-test` or use the `spring-boot-starter-test` starter to pull it in transitively.
|
||||||
|
|
||||||
If you have not used the `spring-test` module before, you should start by reading the {url-spring-framework-docs}/testing.html[relevant section] of the Spring Framework reference documentation.
|
If you have not used the `spring-test` module before, you should start by reading the {url-spring-framework-docs}/testing.html[relevant section] of the Spring Framework reference documentation.
|
||||||
|
|
|
@ -118,7 +118,7 @@ You can then import the class explicitly where it is required, as shown in the f
|
||||||
include-code::MyTests[]
|
include-code::MyTests[]
|
||||||
|
|
||||||
NOTE: If you directly use `@ComponentScan` (that is, not through `@SpringBootApplication`) you need to register the `TypeExcludeFilter` with it.
|
NOTE: If you directly use `@ComponentScan` (that is, not through `@SpringBootApplication`) you need to register the `TypeExcludeFilter` with it.
|
||||||
See xref:api:java/org/springframework/boot/context/TypeExcludeFilter.html[the Javadoc] for details.
|
See the xref:api:java/org/springframework/boot/context/TypeExcludeFilter.html[`TypeExcludeFilter`] API documentation for details.
|
||||||
|
|
||||||
NOTE: An imported `@TestConfiguration` is processed earlier than an inner-class `@TestConfiguration` and an imported `@TestConfiguration` will be processed before any configuration found through component scanning.
|
NOTE: An imported `@TestConfiguration` is processed earlier than an inner-class `@TestConfiguration` and an imported `@TestConfiguration` will be processed before any configuration found through component scanning.
|
||||||
Generally speaking, this difference in ordering has no noticeable effect but it is something to be aware of if you're relying on bean overriding.
|
Generally speaking, this difference in ordering has no noticeable effect but it is something to be aware of if you're relying on bean overriding.
|
||||||
|
@ -263,7 +263,7 @@ By the time the test is executed, the application context refresh has completed
|
||||||
We recommend using a `@Bean` method to create and configure the mock in this situation.
|
We recommend using a `@Bean` method to create and configure the mock in this situation.
|
||||||
|
|
||||||
Additionally, you can use `@SpyBean` to wrap any existing bean with a Mockito `spy`.
|
Additionally, you can use `@SpyBean` to wrap any existing bean with a Mockito `spy`.
|
||||||
See the xref:api:java/org/springframework/boot/test/mock/mockito/SpyBean.html[Javadoc] for full details.
|
See the xref:api:java/org/springframework/boot/test/mock/mockito/SpyBean.html[`SpyBean`] API documentation for full details.
|
||||||
|
|
||||||
NOTE: While Spring's test framework caches application contexts between tests and reuses a context for tests sharing the same configuration, the use of `@MockBean` or `@SpyBean` influences the cache key, which will most likely increase the number of contexts.
|
NOTE: While Spring's test framework caches application contexts between tests and reuses a context for tests sharing the same configuration, the use of `@MockBean` or `@SpyBean` influences the cache key, which will most likely increase the number of contexts.
|
||||||
|
|
||||||
|
@ -366,7 +366,7 @@ If you define your own `webDriver` scope you may find it stops working when you
|
||||||
|
|
||||||
If you have Spring Security on the classpath, `@WebMvcTest` will also scan `WebSecurityConfigurer` beans.
|
If you have Spring Security on the classpath, `@WebMvcTest` will also scan `WebSecurityConfigurer` beans.
|
||||||
Instead of disabling security completely for such tests, you can use Spring Security's test support.
|
Instead of disabling security completely for such tests, you can use Spring Security's test support.
|
||||||
More details on how to use Spring Security's `MockMvc` support can be found in this _xref:how-to:testing.adoc#howto.testing.with-spring-security[Testing With Spring Security]_ how-to section.
|
More details on how to use Spring Security's `MockMvc` support can be found in this xref:how-to:testing.adoc#howto.testing.with-spring-security[] "`How-to Guides`" section.
|
||||||
|
|
||||||
TIP: Sometimes writing Spring MVC tests is not enough; Spring Boot can help you run xref:testing/spring-boot-applications.adoc#testing.spring-boot-applications.with-running-server[full end-to-end tests with an actual server].
|
TIP: Sometimes writing Spring MVC tests is not enough; Spring Boot can help you run xref:testing/spring-boot-applications.adoc#testing.spring-boot-applications.with-running-server[full end-to-end tests with an actual server].
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ You can use `@DataCassandraTest` to test Cassandra applications.
|
||||||
By default, it configures a `CassandraTemplate`, scans for `@Table` classes, and configures Spring Data Cassandra repositories.
|
By default, it configures a `CassandraTemplate`, scans for `@Table` classes, and configures Spring Data Cassandra repositories.
|
||||||
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataCassandraTest` annotation is used.
|
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataCassandraTest` annotation is used.
|
||||||
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
|
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
|
||||||
(For more about using Cassandra with Spring Boot, see "xref:data/nosql.adoc#data.nosql.cassandra[Cassandra]".)
|
(For more about using Cassandra with Spring Boot, see xref:data/nosql.adoc#data.nosql.cassandra[].)
|
||||||
|
|
||||||
TIP: A list of the auto-configuration settings that are enabled by `@DataCassandraTest` can be xref:appendix:test-auto-configuration/index.adoc[found in the appendix].
|
TIP: A list of the auto-configuration settings that are enabled by `@DataCassandraTest` can be xref:appendix:test-auto-configuration/index.adoc[found in the appendix].
|
||||||
|
|
||||||
|
@ -489,7 +489,7 @@ You can use `@DataCouchbaseTest` to test Couchbase applications.
|
||||||
By default, it configures a `CouchbaseTemplate` or `ReactiveCouchbaseTemplate`, scans for `@Document` classes, and configures Spring Data Couchbase repositories.
|
By default, it configures a `CouchbaseTemplate` or `ReactiveCouchbaseTemplate`, scans for `@Document` classes, and configures Spring Data Couchbase repositories.
|
||||||
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataCouchbaseTest` annotation is used.
|
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataCouchbaseTest` annotation is used.
|
||||||
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
|
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
|
||||||
(For more about using Couchbase with Spring Boot, see "xref:data/nosql.adoc#data.nosql.couchbase[Couchbase]", earlier in this chapter.)
|
(For more about using Couchbase with Spring Boot, see xref:data/nosql.adoc#data.nosql.couchbase[], earlier in this chapter.)
|
||||||
|
|
||||||
TIP: A list of the auto-configuration settings that are enabled by `@DataCouchbaseTest` can be xref:appendix:test-auto-configuration/index.adoc[found in the appendix].
|
TIP: A list of the auto-configuration settings that are enabled by `@DataCouchbaseTest` can be xref:appendix:test-auto-configuration/index.adoc[found in the appendix].
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ You can use `@DataElasticsearchTest` to test Elasticsearch applications.
|
||||||
By default, it configures an `ElasticsearchRestTemplate`, scans for `@Document` classes, and configures Spring Data Elasticsearch repositories.
|
By default, it configures an `ElasticsearchRestTemplate`, scans for `@Document` classes, and configures Spring Data Elasticsearch repositories.
|
||||||
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataElasticsearchTest` annotation is used.
|
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataElasticsearchTest` annotation is used.
|
||||||
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
|
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
|
||||||
(For more about using Elasticsearch with Spring Boot, see "xref:data/nosql.adoc#data.nosql.elasticsearch[Elasticsearch]", earlier in this chapter.)
|
(For more about using Elasticsearch with Spring Boot, see xref:data/nosql.adoc#data.nosql.elasticsearch[], earlier in this chapter.)
|
||||||
|
|
||||||
TIP: A list of the auto-configuration settings that are enabled by `@DataElasticsearchTest` can be xref:appendix:test-auto-configuration/index.adoc[found in the appendix].
|
TIP: A list of the auto-configuration settings that are enabled by `@DataElasticsearchTest` can be xref:appendix:test-auto-configuration/index.adoc[found in the appendix].
|
||||||
|
|
||||||
|
@ -570,7 +570,7 @@ If that is not what you want, you can disable transaction management for a test
|
||||||
include-code::MyTransactionalTests[]
|
include-code::MyTransactionalTests[]
|
||||||
|
|
||||||
If you prefer your test to run against a real database, you can use the `@AutoConfigureTestDatabase` annotation in the same way as for `@DataJpaTest`.
|
If you prefer your test to run against a real database, you can use the `@AutoConfigureTestDatabase` annotation in the same way as for `@DataJpaTest`.
|
||||||
(See "xref:testing/spring-boot-applications.adoc#testing.spring-boot-applications.autoconfigured-spring-data-jpa[Auto-configured Data JPA Tests]".)
|
(See xref:testing/spring-boot-applications.adoc#testing.spring-boot-applications.autoconfigured-spring-data-jpa[].)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -589,7 +589,7 @@ See the {url-spring-framework-docs}/testing/testcontext-framework/tx.html#testco
|
||||||
If that is not what you want, you can disable transaction management for a test or for the whole test class as xref:testing/spring-boot-applications.adoc#testing.spring-boot-applications.autoconfigured-jdbc[shown in the JDBC example].
|
If that is not what you want, you can disable transaction management for a test or for the whole test class as xref:testing/spring-boot-applications.adoc#testing.spring-boot-applications.autoconfigured-jdbc[shown in the JDBC example].
|
||||||
|
|
||||||
If you prefer your test to run against a real database, you can use the `@AutoConfigureTestDatabase` annotation in the same way as for `@DataJpaTest`.
|
If you prefer your test to run against a real database, you can use the `@AutoConfigureTestDatabase` annotation in the same way as for `@DataJpaTest`.
|
||||||
(See "xref:testing/spring-boot-applications.adoc#testing.spring-boot-applications.autoconfigured-spring-data-jpa[Auto-configured Data JPA Tests]".)
|
(See xref:testing/spring-boot-applications.adoc#testing.spring-boot-applications.autoconfigured-spring-data-jpa[].)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -606,7 +606,7 @@ TIP: A list of the auto-configurations that are enabled by `@DataR2dbcTest` can
|
||||||
By default, Data R2DBC tests are not transactional.
|
By default, Data R2DBC tests are not transactional.
|
||||||
|
|
||||||
If you prefer your test to run against a real database, you can use the `@AutoConfigureTestDatabase` annotation in the same way as for `@DataJpaTest`.
|
If you prefer your test to run against a real database, you can use the `@AutoConfigureTestDatabase` annotation in the same way as for `@DataJpaTest`.
|
||||||
(See "xref:testing/spring-boot-applications.adoc#testing.spring-boot-applications.autoconfigured-spring-data-jpa[Auto-configured Data JPA Tests]".)
|
(See xref:testing/spring-boot-applications.adoc#testing.spring-boot-applications.autoconfigured-spring-data-jpa[].)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -616,7 +616,7 @@ If you prefer your test to run against a real database, you can use the `@AutoCo
|
||||||
You can use `@JooqTest` in a similar fashion as `@JdbcTest` but for jOOQ-related tests.
|
You can use `@JooqTest` in a similar fashion as `@JdbcTest` but for jOOQ-related tests.
|
||||||
As jOOQ relies heavily on a Java-based schema that corresponds with the database schema, the existing `DataSource` is used.
|
As jOOQ relies heavily on a Java-based schema that corresponds with the database schema, the existing `DataSource` is used.
|
||||||
If you want to replace it with an in-memory database, you can use `@AutoConfigureTestDatabase` to override those settings.
|
If you want to replace it with an in-memory database, you can use `@AutoConfigureTestDatabase` to override those settings.
|
||||||
(For more about using jOOQ with Spring Boot, see "xref:data/sql.adoc#data.sql.jooq[Using jOOQ]".)
|
(For more about using jOOQ with Spring Boot, see xref:data/sql.adoc#data.sql.jooq[].)
|
||||||
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@JooqTest` annotation is used.
|
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@JooqTest` annotation is used.
|
||||||
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
|
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
|
||||||
|
|
||||||
|
@ -639,7 +639,7 @@ You can use `@DataMongoTest` to test MongoDB applications.
|
||||||
By default, it configures a `MongoTemplate`, scans for `@Document` classes, and configures Spring Data MongoDB repositories.
|
By default, it configures a `MongoTemplate`, scans for `@Document` classes, and configures Spring Data MongoDB repositories.
|
||||||
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataMongoTest` annotation is used.
|
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataMongoTest` annotation is used.
|
||||||
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
|
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
|
||||||
(For more about using MongoDB with Spring Boot, see "xref:data/nosql.adoc#data.nosql.mongodb[MongoDB]".)
|
(For more about using MongoDB with Spring Boot, see xref:data/nosql.adoc#data.nosql.mongodb[].)
|
||||||
|
|
||||||
TIP: A list of the auto-configuration settings that are enabled by `@DataMongoTest` can be xref:appendix:test-auto-configuration/index.adoc[found in the appendix].
|
TIP: A list of the auto-configuration settings that are enabled by `@DataMongoTest` can be xref:appendix:test-auto-configuration/index.adoc[found in the appendix].
|
||||||
|
|
||||||
|
@ -656,7 +656,7 @@ You can use `@DataNeo4jTest` to test Neo4j applications.
|
||||||
By default, it scans for `@Node` classes, and configures Spring Data Neo4j repositories.
|
By default, it scans for `@Node` classes, and configures Spring Data Neo4j repositories.
|
||||||
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataNeo4jTest` annotation is used.
|
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataNeo4jTest` annotation is used.
|
||||||
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
|
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
|
||||||
(For more about using Neo4J with Spring Boot, see "xref:data/nosql.adoc#data.nosql.neo4j[Neo4j]".)
|
(For more about using Neo4J with Spring Boot, see xref:data/nosql.adoc#data.nosql.neo4j[].)
|
||||||
|
|
||||||
TIP: A list of the auto-configuration settings that are enabled by `@DataNeo4jTest` can be xref:appendix:test-auto-configuration/index.adoc[found in the appendix].
|
TIP: A list of the auto-configuration settings that are enabled by `@DataNeo4jTest` can be xref:appendix:test-auto-configuration/index.adoc[found in the appendix].
|
||||||
|
|
||||||
|
@ -682,7 +682,7 @@ You can use `@DataRedisTest` to test Redis applications.
|
||||||
By default, it scans for `@RedisHash` classes and configures Spring Data Redis repositories.
|
By default, it scans for `@RedisHash` classes and configures Spring Data Redis repositories.
|
||||||
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataRedisTest` annotation is used.
|
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataRedisTest` annotation is used.
|
||||||
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
|
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
|
||||||
(For more about using Redis with Spring Boot, see "xref:data/nosql.adoc#data.nosql.redis[Redis]".)
|
(For more about using Redis with Spring Boot, see xref:data/nosql.adoc#data.nosql.redis[].)
|
||||||
|
|
||||||
TIP: A list of the auto-configuration settings that are enabled by `@DataRedisTest` can be xref:appendix:test-auto-configuration/index.adoc[found in the appendix].
|
TIP: A list of the auto-configuration settings that are enabled by `@DataRedisTest` can be xref:appendix:test-auto-configuration/index.adoc[found in the appendix].
|
||||||
|
|
||||||
|
@ -699,7 +699,7 @@ You can use `@DataLdapTest` to test LDAP applications.
|
||||||
By default, it configures an in-memory embedded LDAP (if available), configures an `LdapTemplate`, scans for `@Entry` classes, and configures Spring Data LDAP repositories.
|
By default, it configures an in-memory embedded LDAP (if available), configures an `LdapTemplate`, scans for `@Entry` classes, and configures Spring Data LDAP repositories.
|
||||||
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataLdapTest` annotation is used.
|
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataLdapTest` annotation is used.
|
||||||
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
|
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
|
||||||
(For more about using LDAP with Spring Boot, see "xref:data/nosql.adoc#data.nosql.ldap[LDAP]".)
|
(For more about using LDAP with Spring Boot, see xref:data/nosql.adoc#data.nosql.ldap[].)
|
||||||
|
|
||||||
TIP: A list of the auto-configuration settings that are enabled by `@DataLdapTest` can be xref:appendix:test-auto-configuration/index.adoc[found in the appendix].
|
TIP: A list of the auto-configuration settings that are enabled by `@DataLdapTest` can be xref:appendix:test-auto-configuration/index.adoc[found in the appendix].
|
||||||
|
|
||||||
|
@ -810,7 +810,7 @@ include-code::MyRestDocsConfiguration[]
|
||||||
|
|
||||||
You can use `@WebServiceClientTest` to test applications that call web services using the Spring Web Services project.
|
You can use `@WebServiceClientTest` to test applications that call web services using the Spring Web Services project.
|
||||||
By default, it configures a mock `WebServiceServer` bean and automatically customizes your `WebServiceTemplateBuilder`.
|
By default, it configures a mock `WebServiceServer` bean and automatically customizes your `WebServiceTemplateBuilder`.
|
||||||
(For more about using Web Services with Spring Boot, see "xref:io/webservices.adoc[Web Services]".)
|
(For more about using Web Services with Spring Boot, see xref:io/webservices.adoc[].)
|
||||||
|
|
||||||
|
|
||||||
TIP: A list of the auto-configuration settings that are enabled by `@WebServiceClientTest` can be xref:appendix:test-auto-configuration/index.adoc[found in the appendix].
|
TIP: A list of the auto-configuration settings that are enabled by `@WebServiceClientTest` can be xref:appendix:test-auto-configuration/index.adoc[found in the appendix].
|
||||||
|
@ -826,7 +826,7 @@ include-code::MyWebServiceClientTests[]
|
||||||
|
|
||||||
You can use `@WebServiceServerTest` to test applications that implement web services using the Spring Web Services project.
|
You can use `@WebServiceServerTest` to test applications that implement web services using the Spring Web Services project.
|
||||||
By default, it configures a `MockWebServiceClient` bean that can be used to call your web service endpoints.
|
By default, it configures a `MockWebServiceClient` bean that can be used to call your web service endpoints.
|
||||||
(For more about using Web Services with Spring Boot, see "xref:io/webservices.adoc[Web Services]".)
|
(For more about using Web Services with Spring Boot, see xref:io/webservices.adoc[].)
|
||||||
|
|
||||||
|
|
||||||
TIP: A list of the auto-configuration settings that are enabled by `@WebServiceServerTest` can be xref:appendix:test-auto-configuration/index.adoc[found in the appendix].
|
TIP: A list of the auto-configuration settings that are enabled by `@WebServiceServerTest` can be xref:appendix:test-auto-configuration/index.adoc[found in the appendix].
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[[testing.test-scope-dependencies]]
|
[[testing.test-scope-dependencies]]
|
||||||
= Test Scope Dependencies
|
= Test Scope Dependencies
|
||||||
|
|
||||||
The `spring-boot-starter-test` "`Starter`" (in the `test` `scope`) contains the following provided libraries:
|
The `spring-boot-starter-test` starter (in the `test` `scope`) contains the following provided libraries:
|
||||||
|
|
||||||
* https://junit.org/junit5/[JUnit 5]: The de-facto standard for unit testing Java applications.
|
* https://junit.org/junit5/[JUnit 5]: The de-facto standard for unit testing Java applications.
|
||||||
* {url-spring-framework-docs}/testing/integration.html[Spring Test] & Spring Boot Test: Utilities and integration test support for Spring Boot applications.
|
* {url-spring-framework-docs}/testing/integration.html[Spring Test] & Spring Boot Test: Utilities and integration test support for Spring Boot applications.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[[using.build-systems]]
|
[[using.build-systems]]
|
||||||
= Build Systems
|
= Build Systems
|
||||||
|
|
||||||
It is strongly recommended that you choose a build system that supports xref:using/build-systems.adoc#using.build-systems.dependency-management[_dependency management_] and that can consume artifacts published to the "`Maven Central`" repository.
|
It is strongly recommended that you choose a build system that supports xref:using/build-systems.adoc#using.build-systems.dependency-management[dependency management] and that can consume artifacts published to the Maven Central repository.
|
||||||
We would recommend that you choose Maven or Gradle.
|
We would recommend that you choose Maven or Gradle.
|
||||||
It is possible to get Spring Boot to work with other build systems (Ant, for example), but they are not particularly well supported.
|
It is possible to get Spring Boot to work with other build systems (Ant, for example), but they are not particularly well supported.
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ A typical `build.xml` looks like the following example:
|
||||||
</project>
|
</project>
|
||||||
----
|
----
|
||||||
|
|
||||||
TIP: If you do not want to use the `spring-boot-antlib` module, see the _xref:how-to:build.adoc#howto.build.build-an-executable-archive-with-ant-without-using-spring-boot-antlib[Build an Executable Archive From Ant without Using spring-boot-antlib]_ "`How-to`" .
|
TIP: If you do not want to use the `spring-boot-antlib` module, see the xref:how-to:build.adoc#howto.build.build-an-executable-archive-with-ant-without-using-spring-boot-antlib[] section of "`How-to Guides`".
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ This naming structure is intended to help when you need to find a starter.
|
||||||
The Maven integration in many IDEs lets you search dependencies by name.
|
The Maven integration in many IDEs lets you search dependencies by name.
|
||||||
For example, with the appropriate Eclipse or Spring Tools plugin installed, you can press `ctrl-space` in the POM editor and type "`spring-boot-starter`" for a complete list.
|
For example, with the appropriate Eclipse or Spring Tools plugin installed, you can press `ctrl-space` in the POM editor and type "`spring-boot-starter`" for a complete list.
|
||||||
|
|
||||||
As explained in the "`xref:features/developing-auto-configuration.adoc#features.developing-auto-configuration.custom-starter[Creating Your Own Starter]`" section, third party starters should not start with `spring-boot`, as it is reserved for official Spring Boot artifacts.
|
As explained in the xref:features/developing-auto-configuration.adoc#features.developing-auto-configuration.custom-starter[] section, third party starters should not start with `spring-boot`, as it is reserved for official Spring Boot artifacts.
|
||||||
Rather, a third-party starter typically starts with the name of the project.
|
Rather, a third-party starter typically starts with the name of the project.
|
||||||
For example, a third-party starter project called `thirdpartyproject` would typically be named `thirdpartyproject-spring-boot-starter`.
|
For example, a third-party starter project called `thirdpartyproject` would typically be named `thirdpartyproject-spring-boot-starter`.
|
||||||
****
|
****
|
||||||
|
@ -136,7 +136,7 @@ The following application starters are provided by Spring Boot under the `org.sp
|
||||||
.Spring Boot application starters
|
.Spring Boot application starters
|
||||||
include::ROOT:partial$starters/application-starters.adoc[]
|
include::ROOT:partial$starters/application-starters.adoc[]
|
||||||
|
|
||||||
In addition to the application starters, the following starters can be used to add _xref:how-to:actuator.adoc[production ready]_ features:
|
In addition to the application starters, the following starters can be used to add xref:how-to:actuator.adoc[production ready] features:
|
||||||
|
|
||||||
.Spring Boot production starters
|
.Spring Boot production starters
|
||||||
include::ROOT:partial$starters/production-starters.adoc[]
|
include::ROOT:partial$starters/production-starters.adoc[]
|
||||||
|
|
|
@ -26,7 +26,7 @@ dependencies {
|
||||||
----
|
----
|
||||||
|
|
||||||
CAUTION: Devtools might cause classloading issues, in particular in multi-module projects.
|
CAUTION: Devtools might cause classloading issues, in particular in multi-module projects.
|
||||||
xref:using/devtools.adoc#using.devtools.diagnosing-classloading-issues[Diagnosing Classloading Issues] explains how to diagnose and solve them.
|
xref:using/devtools.adoc#using.devtools.diagnosing-classloading-issues[] explains how to diagnose and solve them.
|
||||||
|
|
||||||
NOTE: Developer tools are automatically disabled when running a fully packaged application.
|
NOTE: Developer tools are automatically disabled when running a fully packaged application.
|
||||||
If your application is launched from `java -jar` or if it is started from a special classloader, then it is considered a "`production application`".
|
If your application is launched from `java -jar` or if it is started from a special classloader, then it is considered a "`production application`".
|
||||||
|
@ -105,7 +105,7 @@ NOTE: If you are restarting with Maven or Gradle using the build plugin you must
|
||||||
If you disable forking, the isolated application classloader used by devtools will not be created and restarts will not operate properly.
|
If you disable forking, the isolated application classloader used by devtools will not be created and restarts will not operate properly.
|
||||||
|
|
||||||
TIP: Automatic restart works very well when used with LiveReload.
|
TIP: Automatic restart works very well when used with LiveReload.
|
||||||
xref:using/devtools.adoc#using.devtools.livereload[See the LiveReload section] for details.
|
See the xref:using/devtools.adoc#using.devtools.livereload[] section for details.
|
||||||
If you use JRebel, automatic restarts are disabled in favor of dynamic class reloading.
|
If you use JRebel, automatic restarts are disabled in favor of dynamic class reloading.
|
||||||
Other devtools features (such as LiveReload and property overrides) can still be used.
|
Other devtools features (such as LiveReload and property overrides) can still be used.
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ NOTE: You can only run one LiveReload server at a time.
|
||||||
Before starting your application, ensure that no other LiveReload servers are running.
|
Before starting your application, ensure that no other LiveReload servers are running.
|
||||||
If you start multiple applications from your IDE, only the first has LiveReload support.
|
If you start multiple applications from your IDE, only the first has LiveReload support.
|
||||||
|
|
||||||
WARNING: To trigger LiveReload when a file changes, xref:using/devtools.adoc#using.devtools.restart[Automatic Restart] must be enabled.
|
WARNING: To trigger LiveReload when a file changes, xref:using/devtools.adoc#using.devtools.restart[] must be enabled.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ The next batch can’t be sent to the application, since the server is restartin
|
||||||
This is typically manifested by a warning in the `RemoteSpringApplication` logs about failing to upload some of the classes, and a consequent retry.
|
This is typically manifested by a warning in the `RemoteSpringApplication` logs about failing to upload some of the classes, and a consequent retry.
|
||||||
But it may also lead to application code inconsistency and failure to restart after the first batch of changes is uploaded.
|
But it may also lead to application code inconsistency and failure to restart after the first batch of changes is uploaded.
|
||||||
If you observe such problems constantly, try increasing the `spring.devtools.restart.poll-interval` and `spring.devtools.restart.quiet-period` parameters to the values that fit your development environment.
|
If you observe such problems constantly, try increasing the `spring.devtools.restart.poll-interval` and `spring.devtools.restart.quiet-period` parameters to the values that fit your development environment.
|
||||||
See the xref:using/devtools.adoc#using.devtools.globalsettings.configuring-file-system-watcher[Configuring File System Watcher] section for configuring these properties.
|
See the xref:using/devtools.adoc#using.devtools.globalsettings.configuring-file-system-watcher[] section for configuring these properties.
|
||||||
|
|
||||||
NOTE: Files are only monitored when the remote client is running.
|
NOTE: Files are only monitored when the remote client is running.
|
||||||
If you change a file before starting the remote client, it is not pushed to the remote server.
|
If you change a file before starting the remote client, it is not pushed to the remote server.
|
||||||
|
|
|
@ -6,5 +6,5 @@ It covers topics such as build systems, auto-configuration, and how to run your
|
||||||
We also cover some Spring Boot best practices.
|
We also cover some Spring Boot best practices.
|
||||||
Although there is nothing particularly special about Spring Boot (it is just another library that you can consume), there are a few recommendations that, when followed, make your development process a little easier.
|
Although there is nothing particularly special about Spring Boot (it is just another library that you can consume), there are a few recommendations that, when followed, make your development process a little easier.
|
||||||
|
|
||||||
If you are starting out with Spring Boot, you should probably read the xref:tutorial:first-application/index.adoc[_Developing your first Spring Boot application_] tutorial before diving into this section.
|
If you are starting out with Spring Boot, you should probably read the xref:tutorial:first-application/index.adoc[] tutorial before diving into this section.
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
Once your Spring Boot application is ready for production deployment, there are many options for packaging and optimizing
|
Once your Spring Boot application is ready for production deployment, there are many options for packaging and optimizing
|
||||||
the application.
|
the application.
|
||||||
See the xref:packaging/index.adoc[Packaging] section of the documentation to read about these features.
|
See the xref:packaging/index.adoc[] section of the documentation to read about these features.
|
||||||
|
|
||||||
For additional "production ready" features, such as health, auditing, and metric REST or JMX end-points, consider adding `spring-boot-actuator`.
|
For additional "production ready" features, such as health, auditing, and metric REST or JMX end-points, consider adding `spring-boot-actuator`.
|
||||||
See xref:how-to:actuator.adoc[Actuator] for details.
|
See xref:how-to:actuator.adoc[] for details.
|
||||||
|
|
|
@ -6,7 +6,7 @@ The sample applies to debugging Spring Boot applications.
|
||||||
You do not need any special IDE plugins or extensions.
|
You do not need any special IDE plugins or extensions.
|
||||||
|
|
||||||
NOTE: The options below are best suited for running an application locally for development.
|
NOTE: The options below are best suited for running an application locally for development.
|
||||||
For production deployment, see xref:reference:using/packaging-for-production.adoc[Packaging for Production].
|
For production deployment, see xref:reference:using/packaging-for-production.adoc[].
|
||||||
|
|
||||||
NOTE: This section only covers jar-based packaging.
|
NOTE: This section only covers jar-based packaging.
|
||||||
If you choose to package your application as a war file, see your server and IDE documentation.
|
If you choose to package your application as a war file, see your server and IDE documentation.
|
||||||
|
@ -101,4 +101,4 @@ JVM hot swapping is somewhat limited with the bytecode that it can replace.
|
||||||
For a more complete solution, https://www.jrebel.com/products/jrebel[JRebel] can be used.
|
For a more complete solution, https://www.jrebel.com/products/jrebel[JRebel] can be used.
|
||||||
|
|
||||||
The `spring-boot-devtools` module also includes support for quick application restarts.
|
The `spring-boot-devtools` module also includes support for quick application restarts.
|
||||||
See the xref:how-to:hotswapping.adoc[Hot swapping "`How-to`"] for details.
|
See the xref:how-to:hotswapping.adoc[] section in "`How-to Guides`" for details.
|
||||||
|
|
|
@ -9,7 +9,7 @@ The exact way in which new requests are not permitted varies depending on the we
|
||||||
Implementations may stop accepting requests at the network layer, or they may return a response with a specific HTTP status code or HTTP header.
|
Implementations may stop accepting requests at the network layer, or they may return a response with a specific HTTP status code or HTTP header.
|
||||||
The use of persistent connections can also change the way that requests stop being accepted.
|
The use of persistent connections can also change the way that requests stop being accepted.
|
||||||
|
|
||||||
TIP: To learn about more the specific method used with your web server, see the `shutDownGracefully` javadoc for xref:api:java/org/springframework/boot/web/embedded/tomcat/TomcatWebServer.html#shutDownGracefully(org.springframework.boot.web.server.GracefulShutdownCallback)[TomcatWebServer], xref:api:java/org/springframework/boot/web/embedded/netty/NettyWebServer.html#shutDownGracefully(org.springframework.boot.web.server.GracefulShutdownCallback)[NettyWebServer], xref:api:java/org/springframework/boot/web/embedded/jetty/JettyWebServer.html#shutDownGracefully(org.springframework.boot.web.server.GracefulShutdownCallback)[JettyWebServer] or xref:api:java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.html#shutDownGracefully(org.springframework.boot.web.server.GracefulShutdownCallback)[UndertowWebServer].
|
TIP: To learn about more the specific method used with your web server, see the `shutDownGracefully` API documentation for xref:api:java/org/springframework/boot/web/embedded/tomcat/TomcatWebServer.html#shutDownGracefully(org.springframework.boot.web.server.GracefulShutdownCallback)[`TomcatWebServer`], xref:api:java/org/springframework/boot/web/embedded/netty/NettyWebServer.html#shutDownGracefully(org.springframework.boot.web.server.GracefulShutdownCallback)[`NettyWebServer`], xref:api:java/org/springframework/boot/web/embedded/jetty/JettyWebServer.html#shutDownGracefully(org.springframework.boot.web.server.GracefulShutdownCallback)[`JettyWebServer`] or xref:api:java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.html#shutDownGracefully(org.springframework.boot.web.server.GracefulShutdownCallback)[`UndertowWebServer`].
|
||||||
|
|
||||||
Jetty, Reactor Netty, and Tomcat will stop accepting new requests at the network layer.
|
Jetty, Reactor Netty, and Tomcat will stop accepting new requests at the network layer.
|
||||||
Undertow will accept new connections but respond immediately with a service unavailable (503) response.
|
Undertow will accept new connections but respond immediately with a service unavailable (503) response.
|
||||||
|
|
|
@ -6,4 +6,4 @@ You can create a self-contained HTTP server by using embedded Tomcat, Jetty, Und
|
||||||
Most web applications use the `spring-boot-starter-web` module to get up and running quickly.
|
Most web applications use the `spring-boot-starter-web` module to get up and running quickly.
|
||||||
You can also choose to build reactive web applications by using the `spring-boot-starter-webflux` module.
|
You can also choose to build reactive web applications by using the `spring-boot-starter-webflux` module.
|
||||||
|
|
||||||
If you have not yet developed a Spring Boot web application, you can follow the "Hello World!" example in the _xref:tutorial:first-application/index.adoc[Getting started]_ section.
|
If you have not yet developed a Spring Boot web application, you can follow the "`Hello World!`" example in the xref:tutorial:first-application/index.adoc[Getting started] section.
|
||||||
|
|
|
@ -273,7 +273,7 @@ When it does so, the orders shown in the following table will be used:
|
||||||
== Embedded Reactive Server Support
|
== Embedded Reactive Server Support
|
||||||
|
|
||||||
Spring Boot includes support for the following embedded reactive web servers: Reactor Netty, Tomcat, Jetty, and Undertow.
|
Spring Boot includes support for the following embedded reactive web servers: Reactor Netty, Tomcat, Jetty, and Undertow.
|
||||||
Most developers use the appropriate “Starter” to obtain a fully configured instance.
|
Most developers use the appropriate starter to obtain a fully configured instance.
|
||||||
By default, the embedded server listens for HTTP requests on port 8080.
|
By default, the embedded server listens for HTTP requests on port 8080.
|
||||||
|
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ For more advanced use cases that require you to extend from `ReactiveWebServerFa
|
||||||
|
|
||||||
Setters are provided for many configuration options.
|
Setters are provided for many configuration options.
|
||||||
Several protected method "`hooks`" are also provided should you need to do something more exotic.
|
Several protected method "`hooks`" are also provided should you need to do something more exotic.
|
||||||
See the xref:api:java/org/springframework/boot/web/reactive/server/ConfigurableReactiveWebServerFactory.html[source code documentation] for details.
|
See the xref:api:java/org/springframework/boot/web/reactive/server/ConfigurableReactiveWebServerFactory.html[`ConfigurableReactiveWebServerFactory`] API documentation for details.
|
||||||
|
|
||||||
NOTE: Auto-configured customizers are still applied on your custom factory, so use that option carefully.
|
NOTE: Auto-configured customizers are still applied on your custom factory, so use that option carefully.
|
||||||
|
|
||||||
|
@ -339,6 +339,6 @@ By default, those resources will be also shared with the Reactor Netty and Jetty
|
||||||
|
|
||||||
Developers can override the resource configuration for Jetty and Reactor Netty by providing a custom `ReactorResourceFactory` or `JettyResourceFactory` bean - this will be applied to both clients and servers.
|
Developers can override the resource configuration for Jetty and Reactor Netty by providing a custom `ReactorResourceFactory` or `JettyResourceFactory` bean - this will be applied to both clients and servers.
|
||||||
|
|
||||||
You can learn more about the resource configuration on the client side in the xref:io/rest-client.adoc#io.rest-client.webclient.runtime[WebClient Runtime section].
|
You can learn more about the resource configuration on the client side in the xref:io/rest-client.adoc#io.rest-client.webclient.runtime[] section.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ The custom instances will be subject to further initialization and configuration
|
||||||
To participate in, and if desired, override that subsequent processing, a `WebMvcConfigurer` should be used.
|
To participate in, and if desired, override that subsequent processing, a `WebMvcConfigurer` should be used.
|
||||||
|
|
||||||
If you do not want to use the auto-configuration and want to take complete control of Spring MVC, add your own `@Configuration` annotated with `@EnableWebMvc`.
|
If you do not want to use the auto-configuration and want to take complete control of Spring MVC, add your own `@Configuration` annotated with `@EnableWebMvc`.
|
||||||
Alternatively, add your own `@Configuration`-annotated `DelegatingWebMvcConfiguration` as described in the Javadoc of `@EnableWebMvc`.
|
Alternatively, add your own `@Configuration`-annotated `DelegatingWebMvcConfiguration` as described in the `@EnableWebMvc` API documentation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -342,7 +342,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`).
|
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.
|
There are a number of `server.error` properties that can be set if you want to customize the default error handling behavior.
|
||||||
See the xref:appendix:application-properties/index.adoc#appendix.application-properties.server["`Server Properties`"] section of the Appendix.
|
See the xref:appendix:application-properties/index.adoc#appendix.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.
|
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.
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ Both the servlet and the filter registrations can be given init parameters by us
|
||||||
== Embedded Servlet Container Support
|
== Embedded Servlet Container Support
|
||||||
|
|
||||||
For servlet application, Spring Boot includes support for embedded https://tomcat.apache.org/[Tomcat], https://www.eclipse.org/jetty/[Jetty], and https://github.com/undertow-io/undertow[Undertow] servers.
|
For servlet application, Spring Boot includes support for embedded https://tomcat.apache.org/[Tomcat], https://www.eclipse.org/jetty/[Jetty], and https://github.com/undertow-io/undertow[Undertow] servers.
|
||||||
Most developers use the appropriate "`Starter`" to obtain a fully configured instance.
|
Most developers use the appropriate starter to obtain a fully configured instance.
|
||||||
By default, the embedded server listens for HTTP requests on port `8080`.
|
By default, the embedded server listens for HTTP requests on port `8080`.
|
||||||
|
|
||||||
|
|
||||||
|
@ -684,7 +684,7 @@ For more advanced use cases that require you to extend from `ServletWebServerFac
|
||||||
|
|
||||||
Setters are provided for many configuration options.
|
Setters are provided for many configuration options.
|
||||||
Several protected method "`hooks`" are also provided should you need to do something more exotic.
|
Several protected method "`hooks`" are also provided should you need to do something more exotic.
|
||||||
See the xref:api:java/org/springframework/boot/web/servlet/server/ConfigurableServletWebServerFactory.html[source code documentation] for details.
|
See the xref:api:java/org/springframework/boot/web/servlet/server/ConfigurableServletWebServerFactory.html[`ConfigurableServletWebServerFactory`] API documentation for details.
|
||||||
|
|
||||||
NOTE: Auto-configured customizers are still applied on your custom factory, so use that option carefully.
|
NOTE: Auto-configured customizers are still applied on your custom factory, so use that option carefully.
|
||||||
|
|
||||||
|
|
|
@ -178,8 +178,8 @@ For simplicity, we continue to use a plain text editor for this example.
|
||||||
[[getting-started.first-application.dependencies]]
|
[[getting-started.first-application.dependencies]]
|
||||||
== Adding Classpath Dependencies
|
== Adding Classpath Dependencies
|
||||||
|
|
||||||
Spring Boot provides a number of "`Starters`" that let you add jars to your classpath.
|
Spring Boot provides a number of starters that let you add jars to your classpath.
|
||||||
"`Starters`" provide dependencies that you are likely to need when developing a specific type of application.
|
Starters provide dependencies that you are likely to need when developing a specific type of application.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ Since `spring-boot-starter-web` added Tomcat and Spring MVC, the auto-configurat
|
||||||
|
|
||||||
.Starters and Auto-configuration
|
.Starters and Auto-configuration
|
||||||
****
|
****
|
||||||
Auto-configuration is designed to work well with "`Starters`", but the two concepts are not directly tied.
|
Auto-configuration is designed to work well with starters, but the two concepts are not directly tied.
|
||||||
You are free to pick and choose jar dependencies outside of the starters.
|
You are free to pick and choose jar dependencies outside of the starters.
|
||||||
Spring Boot still does its best to auto-configure your application.
|
Spring Boot still does its best to auto-configure your application.
|
||||||
****
|
****
|
||||||
|
|
Loading…
Reference in New Issue
Block a user