Skip to content

Commit

Permalink
Merge branch '2.2.x' into 2.3.x
Browse files Browse the repository at this point in the history
Closes gh-22410
  • Loading branch information
wilkinsona committed Jul 20, 2020
2 parents 50000cf + 21f733b commit accc1f1
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 65 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.adoc
@@ -1,7 +1,7 @@
= Contributing to Spring Boot

Spring Boot is released under the Apache 2.0 license. If you would like to contribute
something, or simply want to hack on the code this document should help you get started.
something, or want to hack on the code this document should help you get started.



Expand Down Expand Up @@ -57,7 +57,7 @@ added after the original pull request but before a merge.
* The build includes checkstyle rules for many of our code conventions. Run
`./gradlew checkstyleMain checkstyleTest` if you want to check you changes are
compliant.
* Make sure all new `.java` files to have a simple Javadoc class comment with at least an
* Make sure all new `.java` files have a Javadoc class comment with at least an
`@author` tag identifying you, and preferably at least a paragraph on what the class is
for.
* Add the ASF license header comment to all new `.java` files (copy from existing files
Expand Down
12 changes: 6 additions & 6 deletions README.adoc
Expand Up @@ -2,7 +2,7 @@
:docs: https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference
:github: https://github.com/spring-projects/spring-boot

Spring Boot makes it easy to create Spring-powered, production-grade applications and
Spring Boot helps you to create Spring-powered, production-grade applications and
services with absolute minimum fuss. It takes an opinionated view of the Spring platform
so that new and existing users can quickly get to the bits they need.

Expand Down Expand Up @@ -127,7 +127,7 @@ There are a number of modules in Spring Boot, here is a quick overview:
The main library providing features that support the other parts of Spring Boot,
these include:

* The `SpringApplication` class, providing static convenience methods that make it easy
* The `SpringApplication` class, providing static convenience methods that can be used
to write a stand-alone Spring Application. Its sole job is to create and refresh an
appropriate Spring `ApplicationContext`
* Embedded web applications with a choice of container (Tomcat, Jetty or Undertow)
Expand All @@ -154,14 +154,14 @@ Starters are a set of convenient dependency descriptors that you can include in
your application. You get a one-stop-shop for all the Spring and related technology
that you need without having to hunt through sample code and copy paste loads of
dependency descriptors. For example, if you want to get started using Spring and JPA for
database access just include the `spring-boot-starter-data-jpa` dependency in your
database access include the `spring-boot-starter-data-jpa` dependency in your
project, and you are good to go.



=== spring-boot-cli
The Spring command line application compiles and runs Groovy source, making it super
easy to write the absolute minimum of code to get an application running. Spring CLI
The Spring command line application compiles and runs Groovy source, allowing you to
write the absolute minimum of code to get an application running. Spring CLI
can also watch files, automatically recompiling and restarting when they change.


Expand Down Expand Up @@ -222,7 +222,7 @@ The https://spring.io/[spring.io] site contains several guides that show how to
Boot step-by-step:

* https://spring.io/guides/gs/spring-boot/[Building an Application with Spring Boot] is a
very basic guide that shows you how to create a simple application, run it and add some
very basic guide that shows you how to create an application, run it and add some
management services.
* https://spring.io/guides/gs/actuator-service/[Building a RESTful Web Service with Spring
Boot Actuator] is a guide to creating a REST web service and also shows how the server
Expand Down
2 changes: 1 addition & 1 deletion spring-boot-project/spring-boot-actuator/README.adoc
Expand Up @@ -8,7 +8,7 @@ https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#production
covers the features in more detail.

== Enabling the Actuator
The simplest way to enable the features is to add a dependency to the
The recommended way to enable the features is to add a dependency to the
`spring-boot-starter-actuator` '`Starter`'. To add the actuator to a Maven-based project,
add the following '`Starter`' dependency:

Expand Down
Expand Up @@ -14,7 +14,7 @@ However, it is possible to <<configuration-metadata-additional-metadata,write pa
[[configuration-metadata-format]]
== Metadata Format
Configuration metadata files are located inside jars under `META-INF/spring-configuration-metadata.json`.
They use a simple JSON format with items categorized under either "`groups`" or "`properties`" and additional values hints categorized under "hints", as shown in the following example:
They use a JSON format with items categorized under either "`groups`" or "`properties`" and additional values hints categorized under "hints", as shown in the following example:

[source,json,indent=0]
----
Expand Down Expand Up @@ -762,7 +762,7 @@ This dependency ensures that the additional metadata is available when the annot
The processor picks up both classes and methods that are annotated with `@ConfigurationProperties`.
The Javadoc for field values within configuration classes is used to populate the `description` attribute.

NOTE: You should only use simple text with `@ConfigurationProperties` field Javadoc, since they are not processed before being added to the JSON.
NOTE: You should only use plain text with `@ConfigurationProperties` field Javadoc, since they are not processed before being added to the JSON.

If the class has a single constructor with at least one parameters, one property is created per constructor parameter.
Otherwise, properties are discovered through the presence of standard getters and setters with special handling for collection types (that is detected even if only a getter is present).
Expand Down
Expand Up @@ -14,7 +14,7 @@ This section covers some of the more common deployment scenarios.
If you are running your application from a container, you can use an executable jar, but it is also often an advantage to explode it and run it in a different way.
Certain PaaS implementations may also choose to unpack archives before they run.
For example, Cloud Foundry operates this way.
The simplest way to run an unpacked archive is by starting the appropriate launcher, as follows:
One way to run an unpacked archive is by starting the appropriate launcher, as follows:

[indent=0]
----
Expand Down Expand Up @@ -55,7 +55,7 @@ It minimizes divergence between development and production environments.

Ideally, your application, like a Spring Boot executable jar, has everything that it needs to run packaged within it.

In this section, we look at what it takes to get the <<getting-started.adoc#getting-started-first-application, simple application that we developed>> in the "`Getting Started`" section up and running in the Cloud.
In this section, we look at what it takes to get the <<getting-started.adoc#getting-started-first-application, application that we developed>> in the "`Getting Started`" section up and running in the Cloud.



Expand Down Expand Up @@ -286,7 +286,7 @@ The options include:
* AWS Container Registry

Each has different features and pricing models.
In this document, we describe only the simplest option: AWS Elastic Beanstalk.
In this document, we describe to approach using AWS Elastic Beanstalk.



Expand Down Expand Up @@ -458,7 +458,7 @@ Then deploy with `mvn appengine:deploy` (if you need to authenticate first, the
== Installing Spring Boot Applications
In addition to running Spring Boot applications by using `java -jar`, it is also possible to make fully executable applications for Unix systems.
A fully executable jar can be executed like any other executable binary or it can be <<deployment-service,registered with `init.d` or `systemd`>>.
This makes it very easy to install and manage Spring Boot applications in common production environments.
This helps when installing and managing Spring Boot applications in common production environments.

CAUTION: Fully executable jars work by embedding an extra script at the front of the file.
Currently, some tools do not accept this format, so you may not always be able to use this technique.
Expand Down Expand Up @@ -808,7 +808,7 @@ The following environment properties are supported with the default script:
| The explicit location of the jar file, in case the script is being used to launch a jar that it is not actually embedded.

| `DEBUG`
| If not empty, sets the `-x` flag on the shell process, making it easy to see the logic in the script.
| If not empty, sets the `-x` flag on the shell process, allowing you to see the logic in the script.

| `STOP_WAIT_TIME`
| The time in seconds to wait when stopping the application before forcing a shutdown (`60` by default).
Expand Down
Expand Up @@ -11,7 +11,7 @@ We then walk you through building your first Spring Boot application, discussing

[[getting-started-introducing-spring-boot]]
== Introducing Spring Boot
Spring Boot makes it easy to create stand-alone, production-grade Spring-based Applications that you can run.
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.

Expand Down Expand Up @@ -170,7 +170,7 @@ Get SDKMAN! from https://sdkman.io and install Spring Boot by using the followin
Spring Boot v{spring-boot-version}
----

If you develop features for the CLI and want easy access to the version you built, use the following commands:
If you develop features for the CLI and want access to the version you built, use the following commands:

[indent=0,subs="verbatim,quotes,attributes"]
----
Expand Down Expand Up @@ -334,7 +334,7 @@ If you manually installed the CLI, follow the <<getting-started-manual-cli-insta

[[getting-started-first-application]]
== Developing Your First Spring Boot Application
This section describes how to develop a simple "`Hello World!`" web application that highlights some of Spring Boot's key features.
This section describes how to develop a small "`Hello World!`" web application that highlights some of Spring Boot's key features.
We use Maven to build this project, since most IDEs support it.

[TIP]
Expand Down Expand Up @@ -544,7 +544,7 @@ Spring Boot still does its best to auto-configure your application.
[[getting-started-first-application-main-method]]
==== The "`main`" Method
The final part of our application is the `main` method.
This is just a standard method that follows the Java convention for an application entry point.
This is a standard method that follows the Java convention for an application entry point.
Our main method delegates to Spring Boot's `SpringApplication` class by calling `run`.
`SpringApplication` bootstraps our application, starting Spring, which, in turn, starts the auto-configured Tomcat web server.
We need to pass `Example.class` as an argument to the `run` method to tell `SpringApplication` which is the primary Spring component.
Expand Down
31 changes: 14 additions & 17 deletions spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto.adoc
Expand Up @@ -38,7 +38,7 @@ The following example registers `ProjectConstraintViolationFailureAnalyzer`:
com.example.ProjectConstraintViolationFailureAnalyzer
----

NOTE: If you need access to the `BeanFactory` or the `Environment`, your `FailureAnalyzer` can simply implement `BeanFactoryAware` or `EnvironmentAware` respectively.
NOTE: If you need access to the `BeanFactory` or the `Environment`, your `FailureAnalyzer` can implement `BeanFactoryAware` or `EnvironmentAware` respectively.



Expand Down Expand Up @@ -415,7 +415,7 @@ Many Spring Boot starters include default embedded containers.
* For reactive stack applications, the `spring-boot-starter-webflux` includes Reactor Netty by including `spring-boot-starter-reactor-netty`, but you can use `spring-boot-starter-tomcat`, `spring-boot-starter-jetty`, or `spring-boot-starter-undertow` instead.

When switching to a different HTTP server, you need to exclude the default dependencies in addition to including the one you need.
Spring Boot provides separate starters for HTTP servers to help make this process as easy as possible.
To help with this process, Spring Boot provides a separate starter for each of the supported HTTP servers.

The following Maven example shows how to exclude Tomcat and include Jetty for Spring MVC:

Expand Down Expand Up @@ -1026,7 +1026,7 @@ The `ObjectMapper` (or `XmlMapper` for Jackson XML converter) instance (created
Spring Boot also has some features to make it easier to customize this behavior.

You can configure the `ObjectMapper` and `XmlMapper` instances by using the environment.
Jackson provides an extensive suite of simple on/off features that can be used to configure various aspects of its processing.
Jackson provides an extensive suite of on/off features that can be used to configure various aspects of its processing.
These features are described in six enums (in Jackson) that map onto properties in the environment:

|===
Expand Down Expand Up @@ -1287,7 +1287,7 @@ This ensures efficient sharing of resources for the server receiving requests an
== Logging
Spring Boot has no mandatory logging dependency, except for the Commons Logging API, which is typically provided by Spring Framework's `spring-jcl` module.
To use https://logback.qos.ch[Logback], you need to include it and `spring-jcl` on the classpath.
The simplest way to do that is through the starters, which all depend on `spring-boot-starter-logging`.
The recommended way to do that is through the starters, which all depend on `spring-boot-starter-logging`.
For a web application, you need only `spring-boot-starter-web`, since it depends transitively on the logging starter.
If you use Maven, the following dependency adds logging for you:

Expand Down Expand Up @@ -1402,7 +1402,7 @@ Spring Boot supports https://logging.apache.org/log4j/2.x/[Log4j 2] for logging
If you use the starters for assembling dependencies, you have to exclude Logback and then include log4j 2 instead.
If you do not use the starters, you need to provide (at least) `spring-jcl` in addition to Log4j 2.

The simplest path is probably through the starters, even though it requires some jiggling with excludes.
The recommended path is through the starters, even though it requires some jiggling with excludes.
The following example shows how to set up the starters in Maven:

[source,xml,indent=0,subs="verbatim,quotes,attributes"]
Expand Down Expand Up @@ -1736,8 +1736,7 @@ See {spring-boot-autoconfigure-module-code}/orm/jpa/HibernateJpaAutoConfiguratio
Hibernate {hibernate-docs}#caching[second-level cache] can be configured for a range of cache providers.
Rather than configuring Hibernate to lookup the cache provider again, it is better to provide the one that is available in the context whenever possible.

If you're using JCache, this is pretty easy.
First, make sure that `org.hibernate:hibernate-jcache` is available on the classpath.
To do this with JCache, first make sure that `org.hibernate:hibernate-jcache` is available on the classpath.
Then, add a `HibernatePropertiesCustomizer` bean as shown in the following example:

[source,java,indent=0]
Expand Down Expand Up @@ -1768,10 +1767,9 @@ Spring Boot auto-configuration switches off its entity manager in the presence o

[[howto-use-two-entity-managers]]
=== Use Two EntityManagers
Even if the default `EntityManagerFactory` works fine, you need to define a new one.
Otherwise, the presence of the second bean of that type switches off the default.
To make it easy to do, you can use the convenient `EntityManagerBuilder` provided by Spring Boot.
Alternatively, you can just the `LocalContainerEntityManagerFactoryBean` directly from Spring ORM, as shown in the following example:
Even if the default `EntityManagerFactory` works fine, you need to define a new one, otherwise the presence of the second bean of that type switches off the default.
You can use the `EntityManagerBuilder` provided by Spring Boot to help you to create one.
Alternatively, you can use the `LocalContainerEntityManagerFactoryBean` directly from Spring ORM, as shown in the following example:

[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
Expand Down Expand Up @@ -1978,7 +1976,7 @@ You can tune that behavior by setting `spring.datasource.continue-on-error`.
=== Initialize a Database Using R2DBC
If you are using R2DBC, the regular `DataSource` auto-configuration backs off so none of the options described above can be used.

If you are using Spring Data R2DBC, you can initialize the database on startup using simple SQL scripts as shown in the following example:
If you are using Spring Data R2DBC, you can initialize the database on startup using SQL scripts as shown in the following example:

[source,java,indent=0]
----
Expand Down Expand Up @@ -2224,7 +2222,7 @@ Overriding the error page with your own depends on the templating technology tha
For example, if you use Thymeleaf, you can add an `error.html` template.
If you use FreeMarker, you can add an `error.ftlh` template.
In general, you need a `View` that resolves with a name of `error` or a `@Controller` that handles the `/error` path.
Unless you replaced some of the default configuration, you should find a `BeanNameViewResolver` in your `ApplicationContext`, so a `@Bean` named `error` would be a simple 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 {spring-boot-autoconfigure-module-code}/web/servlet/error/ErrorMvcAutoConfiguration.java[`ErrorMvcAutoConfiguration`] for more options.

See also the section on "`<<spring-boot-features.adoc#boot-features-error-handling, Error Handling>>`" for details of how to register handlers in the servlet container.
Expand Down Expand Up @@ -2773,8 +2771,7 @@ This means that, in addition to being deployable to a servlet container, you can

[[howto-convert-an-existing-application-to-spring-boot]]
=== Convert an Existing Application to Spring Boot
For a non-web application, it should be easy to convert an existing Spring application to a Spring Boot application.
To do so, throw away the code that creates your `ApplicationContext` and replace it with calls to `SpringApplication` or `SpringApplicationBuilder`.
To convert an existing non-web Spring application to a Spring Boot application, replace the code that creates your `ApplicationContext` and replace it with calls to `SpringApplication` or `SpringApplicationBuilder`.
Spring MVC web applications are generally amenable to first creating a deployable war application and then migrating it later to an executable war or jar.
See the https://spring.io/guides/gs/convert-jar-to-war/[Getting Started Guide on Converting a jar to a war].

Expand Down Expand Up @@ -2809,7 +2806,7 @@ If you have other features in your application (for instance, using other servle
* A `@Bean` of type `Servlet` or `ServletRegistrationBean` installs that bean in the container as if it were a `<servlet/>` and `<servlet-mapping/>` in `web.xml`.
* A `@Bean` of type `Filter` or `FilterRegistrationBean` behaves similarly (as a `<filter/>` and `<filter-mapping/>`).
* An `ApplicationContext` in an XML file can be added through an `@ImportResource` in your `Application`.
Alternatively, simple cases where annotation configuration is heavily used already can be recreated in a few lines as `@Bean` definitions.
Alternatively, cases where annotation configuration is heavily used already can be recreated in a few lines as `@Bean` definitions.

Once the war file is working, you can make it executable by adding a `main` method to your `Application`, as shown in the following example:

Expand Down Expand Up @@ -2913,7 +2910,7 @@ You can do so by adding a `WEB-INF/weblogic.xml` file with the following content
=== Use Jedis Instead of Lettuce
By default, the Spring Boot starter (`spring-boot-starter-data-redis`) uses https://github.com/lettuce-io/lettuce-core/[Lettuce].
You need to exclude that dependency and include the https://github.com/xetorthio/jedis/[Jedis] one instead.
Spring Boot manages these dependencies to help make this process as easy as possible.
Spring Boot manages both of these dependencies so you can switch to Jedis without specifying a version.

The following example shows how to do so in Maven:

Expand Down

0 comments on commit accc1f1

Please sign in to comment.