Migrate spring-boot-docs to Antora

See gh-33766
This commit is contained in:
Phillip Webb
2024-03-19 21:48:08 -07:00
parent 8ee20c8dae
commit 8dd89c1ac7
202 changed files with 6844 additions and 6593 deletions

View File

@@ -0,0 +1,17 @@
:navicon: question
= Community
If you have trouble with Spring Boot, we would like to help.
* Try the xref:how-to:index.adoc[How-to documents].
They provide solutions to the most common questions.
* Learn the Spring basics.
Spring Boot builds on many other Spring projects.
Check the https://spring.io[spring.io] web-site for a wealth of reference documentation.
If you are starting out with Spring, try one of the https://spring.io/guides[guides].
* Ask a question.
We monitor https://stackoverflow.com[stackoverflow.com] for questions tagged with https://stackoverflow.com/tags/spring-boot[`spring-boot`].
* Report bugs with Spring Boot at https://github.com/spring-projects/spring-boot/issues.
NOTE: All of Spring Boot is open source, including the documentation.
If you find problems with the docs or if you want to improve them, please {url-github}[get involved].

View File

@@ -0,0 +1,156 @@
:navtitle: Documentation
:navicon: book
[[documentation]]
= Documentation Overview
This section provides a brief overview of Spring Boot reference documentation.
It serves as a map for the rest of the document.
[[documentation.first-steps]]
== First Steps
If you are getting started with Spring Boot or 'Spring' in general, start with the following topics:
* *From scratch:* xref:index.adoc[Overview] | xref:system-requirements.adoc[Requirements] | xref:installing.adoc[Installation]
* *Tutorial:* xref:tutorial:first-application/index.adoc[Part 1] | xref:tutorial:first-application/index.adoc#getting-started.first-application.code[Part 2]
* *Running your example:* xref:tutorial:first-application/index.adoc#getting-started.first-application.run[Part 1] | xref:tutorial:first-application/index.adoc#getting-started.first-application.executable-jar[Part 2]
[[documentation.upgrading]]
== Upgrading From an Earlier Version
You should always ensure that you are running a {url-github-wiki}/Supported-Versions[supported version] of Spring Boot.
Depending on the version that you are upgrading to, you can find some additional tips here:
* *From 1.x:* xref:upgrading.adoc#upgrading.from-1x[Upgrading from 1.x]
* *To a new feature release:* xref:upgrading.adoc#upgrading.to-feature[Upgrading to New Feature Release]
* *Spring Boot CLI:* xref:upgrading.adoc#upgrading.cli[Upgrading the Spring Boot CLI]
[[documentation.using]]
== Developing With Spring Boot
Ready to actually start using Spring Boot? xref:reference:using/index.adoc[We have you covered]:
* *Build systems:* xref:reference:using/build-systems.adoc#using.build-systems.maven[Maven] | xref:reference:using/build-systems.adoc#using.build-systems.gradle[Gradle] | xref:reference:using/build-systems.adoc#using.build-systems.ant[Ant] | xref:reference:using/build-systems.adoc#using.build-systems.starters[Starters]
* *Best practices:* xref:reference:using/structuring-your-code.adoc[Code Structure] | xref:reference:using/configuration-classes.adoc[@Configuration] | xref:reference:using/auto-configuration.adoc[@EnableAutoConfiguration] | xref:reference:using/spring-beans-and-dependency-injection.adoc[Beans and Dependency Injection]
* *Running your code:* xref:reference:using/running-your-application.adoc#using.running-your-application.from-an-ide[IDE] | xref:reference:using/running-your-application.adoc#using.running-your-application.as-a-packaged-application[Packaged] | xref:reference:using/running-your-application.adoc#using.running-your-application.with-the-maven-plugin[Maven] | xref:reference:using/running-your-application.adoc#using.running-your-application.with-the-gradle-plugin[Gradle]
* *Packaging your app:* xref:reference:using/packaging-for-production.adoc[Production jars]
* *Spring Boot CLI:* xref:cli:index.adoc[Using the CLI]
[[documentation.features]]
== Learning About Spring Boot Features
Need more details about Spring Boot's core features?
xref:reference:features/index.adoc[The following content is for you]:
* *Spring Application:* xref:reference:features/spring-application.adoc[SpringApplication]
* *External Configuration:* xref:reference:features/external-config.adoc[External Configuration]
* *Profiles:* xref:reference:features/profiles.adoc[Profiles]
* *Logging:* xref:reference:features/logging.adoc[Logging]
[[documentation.web]]
== Web
If you develop Spring Boot web applications, take a look at the following content:
* *Servlet Web Applications:* xref:reference:web/servlet.adoc[Spring MVC, Jersey, Embedded Servlet Containers]
* *Reactive Web Applications:* xref:reference:web/reactive.adoc[Spring Webflux, Embedded Servlet Containers]
* *Graceful Shutdown:* xref:reference:web/graceful-shutdown.adoc[Graceful Shutdown]
* *Spring Security:* xref:reference:web/spring-security.adoc[Default Security Configuration, Auto-configuration for OAuth2, SAML]
* *Spring Session:* xref:reference:web/spring-session.adoc[Auto-configuration for Spring Session]
* *Spring HATEOAS:* xref:reference:web/spring-hateoas.adoc[Auto-configuration for Spring HATEOAS]
[[documentation.data]]
== Data
If your application deals with a datastore, you can see how to configure that here:
* *SQL:* xref:reference:data/sql.adoc[Configuring a SQL Datastore, Embedded Database support, Connection pools, and more.]
* *NOSQL:* xref:reference:data/nosql.adoc[Auto-configuration for NOSQL stores such as Redis, MongoDB, Neo4j, and others.]
[[documentation.messaging]]
== Messaging
If your application uses any messaging protocol, see one or more of the following sections:
* *JMS:* xref:reference:messaging/jms.adoc[Auto-configuration for ActiveMQ and Artemis, Sending and Receiving messages through JMS]
* *AMQP:* xref:reference:messaging/amqp.adoc[Auto-configuration for RabbitMQ]
* *Kafka:* xref:reference:messaging/kafka.adoc[Auto-configuration for Spring Kafka]
* *Pulsar:* xref:reference:messaging/pulsar.adoc[Auto-configuration for Spring for Apache Pulsar]
* *RSocket:* xref:reference:messaging/rsocket.adoc[Auto-configuration for Spring Framework's RSocket Support]
* *Spring Integration:* xref:reference:messaging/spring-integration.adoc[Auto-configuration for Spring Integration]
[[documentation.io]]
== IO
If your application needs IO capabilities, see one or more of the following sections:
* *Caching:* xref:reference:io/caching.adoc[Caching support with EhCache, Hazelcast, Infinispan, and more]
* *Quartz:* xref:reference:io/quartz.adoc[Quartz Scheduling]
* *Mail:* xref:reference:io/email.adoc[Sending Email]
* *Validation:* xref:reference:io/validation.adoc[JSR-303 Validation]
* *REST Clients:* xref:reference:io/rest-client.adoc[Calling REST Services with RestTemplate and WebClient]
* *Webservices:* xref:reference:io/webservices.adoc[Auto-configuration for Spring Web Services]
* *JTA:* xref:reference:io/jta.adoc[Distributed Transactions with JTA]
[[documentation.container-images]]
== Container Images
Spring Boot provides first-class support for building efficient container images. You can read more about it here:
* *Efficient Container Images:* xref:reference:container-images/efficient-images.adoc[Tips to optimize container images such as Docker images]
* *Dockerfiles:* xref:reference:container-images/dockerfiles.adoc[Building container images using dockerfiles]
* *Cloud Native Buildpacks:* xref:reference:container-images/cloud-native-buildpacks.adoc[Support for Cloud Native Buildpacks with Maven and Gradle]
[[documentation.actuator]]
== Moving to Production
When you are ready to push your Spring Boot application to production, we have xref:how-to:actuator.adoc[some tricks] that you might like:
* *Management endpoints:* xref:reference:actuator/endpoints.adoc[Overview]
* *Connection options:* xref:reference:actuator/monitoring.adoc[HTTP] | xref:reference:actuator/jmx.adoc[JMX]
* *Monitoring:* xref:reference:actuator/metrics.adoc[Metrics] | xref:reference:actuator/auditing.adoc[Auditing] | xref:reference:actuator/http-exchanges.adoc[HTTP Exchanges] | xref:reference:actuator/process-monitoring.adoc[Process]
[[documentation.native-images]]
== GraalVM Native Images
Spring Boot applications can be converted into native executables using GraalVM.
You can read more about our native image support here:
* *GraalVM Native Images:* xref:reference:native-image/introducing-graalvm-native-images.adoc[Introduction] | xref:reference:native-image/introducing-graalvm-native-images.adoc#native-image.introducing-graalvm-native-images.key-differences-with-jvm-deployments[Key Differences with the JVM] | xref:reference:native-image/introducing-graalvm-native-images.adoc#native-image.introducing-graalvm-native-images.understanding-aot-processing[Ahead-of-Time Processing]
* *Getting Started:* xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.buildpacks[Buildpacks] | xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.native-build-tools[Native Build Tools]
* *Testing:* xref:reference:native-image/testing-native-applications.adoc#native-image.testing.with-the-jvm[JVM] | xref:reference:native-image/testing-native-applications.adoc#native-image.testing.with-native-build-tools[Native Build Tools]
* *Advanced Topics:* xref:reference:native-image/advanced-topics.adoc#native-image.advanced.nested-configuration-properties[Nested Configuration Properties] | xref:reference:native-image/advanced-topics.adoc#native-image.advanced.converting-executable-jars[Converting JARs] | xref:reference:native-image/advanced-topics.adoc#native-image.advanced.known-limitations[Known Limitations]
[[documentation.advanced]]
== Advanced Topics
Finally, we have a few topics for more advanced users:
* *Spring Boot Applications Deployment:* xref:reference:deployment/cloud.adoc[Cloud Deployment] | xref:reference:deployment/installing.adoc[OS Service]
* *Build tool plugins:* xref:maven-plugin:index.adoc[Maven] | xref:gradle-plugin:index.adoc[Gradle]
* *Appendix:* xref:appendix:application-properties/index.adoc[Application Properties] | xref:specification:configuration-metadata/index.adoc[Configuration Metadata] | xref:appendix:auto-configuration-classes/index.adoc[Auto-configuration Classes] | xref:appendix:test-auto-configuration/index.adoc[Test Auto-configuration Annotations] | xref:specification:executable-jar/index.adoc[Executable Jars] | xref:appendix:dependency-versions/index.adoc[Dependency Versions]

View File

@@ -0,0 +1,16 @@
:navtitle: Overview
:navicon: home
= Spring Boot
Spring Boot helps you to create stand-alone, production-grade Spring-based applications that you can run.
We take an opinionated view of the Spring platform and third-party libraries, so that you can get started with minimum fuss.
Most Spring Boot applications need very little Spring configuration.
You can use Spring Boot to create Java applications that can be started by using `java -jar` or more traditional war deployments.
Our primary goals are:
* Provide a radically faster and widely accessible getting-started experience for all Spring development.
* Be opinionated out of the box but get out of the way quickly as requirements start to diverge from the defaults.
* Provide a range of non-functional features that are common to large classes of projects (such as embedded servers, security, metrics, health checks, and externalized configuration).
* Absolutely no code generation (when not targeting native image) and no requirement for XML configuration.

View File

@@ -0,0 +1,210 @@
:navicon: gift
[[getting-started.installing]]
= Installing Spring Boot
Spring Boot can be used with "`classic`" Java development tools or installed as a command line tool.
Either way, you need https://www.java.com[Java SDK v17] or higher.
Before you begin, you should check your current Java installation by using the following command:
[source,shell]
----
$ java -version
----
If you are new to Java development or if you want to experiment with Spring Boot, you might want to try the xref:installing.adoc#getting-started.installing.cli[Spring Boot CLI] (Command Line Interface) first.
Otherwise, read on for "`classic`" installation instructions.
[[getting-started.installing.java]]
== Installation Instructions for the Java Developer
You can use Spring Boot in the same way as any standard Java library.
To do so, include the appropriate `+spring-boot-*.jar+` files on your classpath.
Spring Boot does not require any special tools integration, so you can use any IDE or text editor.
Also, there is nothing special about a Spring Boot application, so you can run and debug a Spring Boot application as you would any other Java program.
Although you _could_ copy Spring Boot jars, we generally recommend that you use a build tool that supports dependency management (such as Maven or Gradle).
[[getting-started.installing.java.maven]]
=== Maven Installation
Spring Boot is compatible with Apache Maven 3.6.3 or later.
If you do not already have Maven installed, you can follow the instructions at https://maven.apache.org.
TIP: On many operating systems, Maven can be installed with a package manager.
If you use OSX Homebrew, try `brew install maven`.
Ubuntu users can run `sudo apt-get install maven`.
Windows users with https://chocolatey.org/[Chocolatey] can run `choco install maven` from an elevated (administrator) prompt.
Spring Boot dependencies use the `org.springframework.boot` 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`"].
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.
[[getting-started.installing.java.gradle]]
=== Gradle Installation
Spring Boot is compatible with Gradle 7.x (7.5 or later) and 8.x.
If you do not already have Gradle installed, you can follow the instructions at https://gradle.org.
Spring Boot dependencies can be declared by using the `org.springframework.boot` `group`.
Typically, your project declares dependencies to one or more 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.
.Gradle Wrapper
****
The Gradle Wrapper provides a nice way of "`obtaining`" Gradle when you need to build a project.
It is a small script and library that you commit alongside your code to bootstrap the build process.
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.
[[getting-started.installing.cli]]
== Installing the Spring Boot CLI
The Spring Boot CLI (Command Line Interface) is a command line tool that you can use to quickly prototype with Spring.
You do not need to use the CLI to work with Spring Boot, but it is a quick way to get a Spring application off the ground without an IDE.
[[getting-started.installing.cli.manual-installation]]
=== Manual Installation
ifeval::["{artifact-release-type}" == "snapshot"]
You can download one of the `spring-boot-cli-\*-bin.zip` or `spring-boot-cli-*-bin.tar.gz` files from the {url-artifact-repository}/org/springframework/boot/spring-boot-cli/{version-spring-boot}/[Spring software repository].
endif::[]
ifeval::["{artifact-release-type}" != "snapshot"]
You can download the Spring CLI distribution from one of the following locations:
* {url-artifact-repository}/org/springframework/boot/spring-boot-cli/{version-spring-boot}/spring-boot-cli-{version-spring-boot}-bin.zip[spring-boot-cli-{version-spring-boot}-bin.zip]
* {url-artifact-repository}/org/springframework/boot/spring-boot-cli/{version-spring-boot}/spring-boot-cli-{version-spring-boot}-bin.tar.gz[spring-boot-cli-{version-spring-boot}-bin.tar.gz]
endif::[]
Once downloaded, follow the {url-github-raw}/spring-boot-project/spring-boot-tools/spring-boot-cli/src/main/content/INSTALL.txt[INSTALL.txt] instructions from the unpacked archive.
In summary, there is a `spring` script (`spring.bat` for Windows) in a `bin/` directory in the `.zip` file.
Alternatively, you can use `java -jar` with the `.jar` file (the script helps you to be sure that the classpath is set correctly).
[[getting-started.installing.cli.sdkman]]
=== Installation with SDKMAN!
SDKMAN! (The Software Development Kit Manager) can be used for managing multiple versions of various binary SDKs, including Groovy and the Spring Boot CLI.
Get SDKMAN! from https://sdkman.io and install Spring Boot by using the following commands:
[source,shell,subs="verbatim,attributes"]
----
$ sdk install springboot
$ spring --version
Spring CLI v{version-spring-boot}
----
If you develop features for the CLI and want access to the version you built, use the following commands:
[source,shell,subs="verbatim,attributes"]
----
$ sdk install springboot dev /path/to/spring-boot/spring-boot-cli/target/spring-boot-cli-{version-spring-boot}-bin/spring-{version-spring-boot}/
$ sdk default springboot dev
$ spring --version
Spring CLI v{version-spring-boot}
----
The preceding instructions install a local instance of `spring` called the `dev` instance.
It points at your target build location, so every time you rebuild Spring Boot, `spring` is up-to-date.
You can see it by running the following command:
[source,shell,subs="verbatim,attributes"]
----
$ sdk ls springboot
================================================================================
Available Springboot Versions
================================================================================
> + dev
* {version-spring-boot}
================================================================================
+ - local version
* - installed
> - currently in use
================================================================================
----
[[getting-started.installing.cli.homebrew]]
=== OSX Homebrew Installation
If you are on a Mac and use https://brew.sh/[Homebrew], you can install the Spring Boot CLI by using the following commands:
[source,shell]
----
$ brew tap spring-io/tap
$ brew install spring-boot
----
Homebrew installs `spring` to `/usr/local/bin`.
NOTE: If you do not see the formula, your installation of brew might be out-of-date.
In that case, run `brew update` and try again.
[[getting-started.installing.cli.macports]]
=== MacPorts Installation
If you are on a Mac and use https://www.macports.org/[MacPorts], you can install the Spring Boot CLI by using the following command:
[source,shell]
----
$ sudo port install spring-boot-cli
----
[[getting-started.installing.cli.completion]]
=== Command-line Completion
The Spring Boot CLI includes scripts that provide command completion for the https://en.wikipedia.org/wiki/Bash_%28Unix_shell%29[BASH] and https://en.wikipedia.org/wiki/Z_shell[zsh] shells.
You can `source` the script (also named `spring`) in any shell or put it in your personal or system-wide bash completion initialization.
On a Debian system, the system-wide scripts are in `<installation location>/shell-completion/bash` and all scripts in that directory are executed when a new shell starts.
For example, to run the script manually if you have installed by using SDKMAN!, use the following commands:
[source,shell]
----
$ . ~/.sdkman/candidates/springboot/current/shell-completion/bash/spring
$ spring <HIT TAB HERE>
grab help jar run test version
----
NOTE: If you install the Spring Boot CLI by using Homebrew or MacPorts, the command-line completion scripts are automatically registered with your shell.
[[getting-started.installing.cli.scoop]]
=== Windows Scoop Installation
If you are on a Windows and use https://scoop.sh/[Scoop], you can install the Spring Boot CLI by using the following commands:
[source,shell]
----
$ scoop bucket add extras
$ scoop install springboot
----
Scoop installs `spring` to `~/scoop/apps/springboot/current/bin`.
NOTE: If you do not see the app manifest, your installation of scoop might be out-of-date.
In that case, run `scoop update` and try again.

View File

@@ -0,0 +1,62 @@
:navicon: server
[[getting-started.system-requirements]]
= System Requirements
Spring Boot {version-spring-boot} requires https://www.java.com[Java 17] and is compatible up to and including Java 21.
{url-spring-framework-docs}/[Spring Framework {version-spring-framework}] or above is also required.
Explicit build support is provided for the following build tools:
|===
| Build Tool | Version
| Maven
| 3.6.3 or later
| Gradle
| 7.x (7.5 or later) and 8.x
|===
[[getting-started.system-requirements.servlet-containers]]
== Servlet Containers
Spring Boot supports the following embedded servlet containers:
|===
| Name | Servlet Version
| Tomcat 10.1
| 6.0
| Jetty 12.0
| 6.0
| Undertow 2.3
| 6.0
|===
You can also deploy Spring Boot applications to any servlet 5.0+ compatible container.
[[getting-started.system-requirements.graal]]
== GraalVM Native Images
Spring Boot applications can be xref:reference:native-image/introducing-graalvm-native-images.adoc[converted into a Native Image] using GraalVM {version-graal} or above.
Images can be created using the https://github.com/graalvm/native-build-tools[native build tools] Gradle/Maven plugins or `native-image` tool provided by GraalVM.
You can also create native images using the https://github.com/paketo-buildpacks/native-image[native-image Paketo buildpack].
The following versions are supported:
|===
| Name | Version
| GraalVM Community
| {version-graal}
| Native Build Tools
| {version-native-build-tools}
|===

View File

@@ -0,0 +1,47 @@
:navicon: rocket
[[upgrading]]
= Upgrading Spring Boot
Instructions for how to upgrade from earlier versions of Spring Boot are provided on the project {url-github-wiki}[wiki].
Follow the links in the {url-github-wiki}#release-notes[release notes] section to find the version that you want to upgrade to.
Upgrading instructions are always the first item in the release notes.
If you are more than one release behind, please make sure that you also review the release notes of the versions that you jumped.
[[upgrading.from-1x]]
== 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.
Check also the {url-github-wiki}["`release notes`"] for a list of "`new and noteworthy`" features for each release.
[[upgrading.to-feature]]
== Upgrading to a New Feature Release
When upgrading to a new feature release, some properties may have been renamed or removed.
Spring Boot provides a way to analyze your application's environment and print diagnostics at startup, but also temporarily migrate properties at runtime for you.
To enable that feature, add the following dependency to your project:
[source,xml]
----
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-properties-migrator</artifactId>
<scope>runtime</scope>
</dependency>
----
WARNING: Properties that are added late to the environment, such as when using `@PropertySource`, will not be taken into account.
NOTE: Once you finish the migration, please make sure to remove this module from your project's dependencies.
[[upgrading.cli]]
== Upgrading the Spring Boot CLI
To upgrade an existing CLI installation, use the appropriate package manager command (for example, `brew upgrade`).
If you manually installed the CLI, follow the xref:installing.adoc#getting-started.installing.cli.manual-installation[standard instructions], remembering to update your `PATH` environment variable to remove any older references.

View File

@@ -0,0 +1,6 @@
* xref:index.adoc[]
* xref:documentation.adoc[]
* xref:community.adoc[]
* xref:system-requirements.adoc[]
* xref:installing.adoc[]
* xref:upgrading.adoc[]