Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
6a503d5c
Commit
6a503d5c
authored
Oct 09, 2014
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix loads of asciidoc errors
parent
b85926e6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
124 additions
and
123 deletions
+124
-123
pom.xml
spring-boot-docs/pom.xml
+1
-1
appendix-executable-jar-format.adoc
...ocs/src/main/asciidoc/appendix-executable-jar-format.adoc
+1
-1
howto.adoc
spring-boot-docs/src/main/asciidoc/howto.adoc
+52
-52
production-ready-features.adoc
...oot-docs/src/main/asciidoc/production-ready-features.adoc
+23
-23
spring-boot-features.adoc
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+45
-45
using-spring-boot.adoc
spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc
+2
-1
No files found.
spring-boot-docs/pom.xml
View file @
6a503d5c
...
@@ -200,7 +200,7 @@
...
@@ -200,7 +200,7 @@
<plugin>
<plugin>
<groupId>
org.asciidoctor
</groupId>
<groupId>
org.asciidoctor
</groupId>
<artifactId>
asciidoctor-maven-plugin
</artifactId>
<artifactId>
asciidoctor-maven-plugin
</artifactId>
<version>
0.1.4
</version>
<version>
1.5.0
</version>
<executions>
<executions>
<execution>
<execution>
<id>
generate-docbook
</id>
<id>
generate-docbook
</id>
...
...
spring-boot-docs/src/main/asciidoc/appendix-executable-jar-format.adoc
View file @
6a503d5c
...
@@ -140,7 +140,7 @@ file and it's used to setup an appropriate `URLClassLoader` and ultimately call
...
@@ -140,7 +140,7 @@ file and it's used to setup an appropriate `URLClassLoader` and ultimately call
There are 3 launcher subclasses (`JarLauncher`, `WarLauncher` and `PropertiesLauncher`).
There are 3 launcher subclasses (`JarLauncher`, `WarLauncher` and `PropertiesLauncher`).
Their purpose is to load resources (`.class` files etc.) from nested jar files or war
Their purpose is to load resources (`.class` files etc.) from nested jar files or war
files in directories (as opposed to explicitly on the classpath). In the case of the
files in directories (as opposed to explicitly on the classpath). In the case of the
`[Jar|War]Launcher` the nested paths are fixed `(lib/
*.jar` and `lib-provided/
*.jar` for
`[Jar|War]Launcher` the nested paths are fixed `(lib/
\*.jar` and `lib-provided/\
*.jar` for
the war case) so you just add extra jars in those locations if you want more. The
the war case) so you just add extra jars in those locations if you want more. The
`PropertiesLauncher` looks in `lib/` by default, but you can add additional locations by
`PropertiesLauncher` looks in `lib/` by default, but you can add additional locations by
setting an environment variable `LOADER_PATH` or `loader.path` in `application.properties`
setting an environment variable `LOADER_PATH` or `loader.path` in `application.properties`
...
...
spring-boot-docs/src/main/asciidoc/howto.adoc
View file @
6a503d5c
[[howto]]
[[howto]]
=
``How-to''
guides
=
'`How-to`'
guides
[partintro]
[partintro]
--
--
This section provides answers to some common '`
`how do I do that...''
' type of questions
This section provides answers to some common '`
how do I do that...`
' type of questions
that often arise when using Spring Boot. This is by no means an exhaustive list, but it
that often arise when using Spring Boot. This is by no means an exhaustive list, but it
does cover quite a lot.
does cover quite a lot.
...
@@ -12,7 +12,7 @@ http://stackoverflow.com/tags/spring-boot[stackoverflow.com] to see if someone h
...
@@ -12,7 +12,7 @@ http://stackoverflow.com/tags/spring-boot[stackoverflow.com] to see if someone h
already provided an answer; this is also a great place to ask new questions (please use
already provided an answer; this is also a great place to ask new questions (please use
the `spring-boot` tag).
the `spring-boot` tag).
We're also more than happy to extend this section; If you want to add a
``how-to''
you
We're also more than happy to extend this section; If you want to add a
'`how-to`'
you
can send us a {github-code}[pull request].
can send us a {github-code}[pull request].
--
--
...
@@ -25,7 +25,7 @@ can send us a {github-code}[pull request].
...
@@ -25,7 +25,7 @@ can send us a {github-code}[pull request].
[[howto-troubleshoot-auto-configuration]]
[[howto-troubleshoot-auto-configuration]]
=== Troubleshoot auto-configuration
=== Troubleshoot auto-configuration
The Spring Boot auto-configuration tries its best to
``do the right thing''
, but
The Spring Boot auto-configuration tries its best to
'`do the right thing`'
, but
sometimes things fail and it can be hard to tell why.
sometimes things fail and it can be hard to tell why.
There is a really useful `AutoConfigurationReport` available in any Spring Boot
There is a really useful `AutoConfigurationReport` available in any Spring Boot
...
@@ -37,8 +37,8 @@ which not) by Spring Boot at runtime.
...
@@ -37,8 +37,8 @@ which not) by Spring Boot at runtime.
Many more questions can be answered by looking at the source code and the javadoc. Some
Many more questions can be answered by looking at the source code and the javadoc. Some
rules of thumb:
rules of thumb:
* Look for classes called `*AutoConfiguration` and read their sources, in particular the
* Look for classes called `
\
*AutoConfiguration` and read their sources, in particular the
`@Conditional*` annotations to find out what features they enable and when. Add
`@Conditional
\
*` annotations to find out what features they enable and when. Add
`--debug` to the command line or a System property `-Ddebug` to get a log on the
`--debug` to the command line or a System property `-Ddebug` to get a log on the
console of all the autoconfiguration decisions that were made in your app. In a running
console of all the autoconfiguration decisions that were made in your app. In a running
Actuator app look at the `autoconfig` endpoint (`/autoconfig' or the JMX equivalent) for
Actuator app look at the `autoconfig` endpoint (`/autoconfig' or the JMX equivalent) for
...
@@ -80,7 +80,7 @@ The `SpringApplication` sends some special `ApplicationEvents` to the listeners
...
@@ -80,7 +80,7 @@ The `SpringApplication` sends some special `ApplicationEvents` to the listeners
some before the context is created), and then registers the listeners for events published
some before the context is created), and then registers the listeners for events published
by the `ApplicationContext` as well. See
by the `ApplicationContext` as well. See
'<<spring-boot-features.adoc#boot-features-application-events-and-listeners>>' in the
'<<spring-boot-features.adoc#boot-features-application-events-and-listeners>>' in the
``Spring Boot features''
section for a complete list.
'`Spring Boot features`'
section for a complete list.
...
@@ -88,7 +88,7 @@ by the `ApplicationContext` as well. See
...
@@ -88,7 +88,7 @@ by the `ApplicationContext` as well. See
=== 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`
You can use the `ApplicationBuilder` class to create parent/child `ApplicationContext`
hierarchies. See '<<spring-boot-features.adoc#boot-features-fluent-builder-api>>'
hierarchies. See '<<spring-boot-features.adoc#boot-features-fluent-builder-api>>'
in the
``Spring Boot features''
section for more information.
in the
'`Spring Boot features`'
section for more information.
...
@@ -136,7 +136,7 @@ underscores (`_`) as well as dashes (`-`) in property names.
...
@@ -136,7 +136,7 @@ underscores (`_`) as well as dashes (`-`) in property names.
=== 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
By default properties from different sources are added to the Spring `Environment` in a
defined order (see '<<spring-boot-features.adoc#boot-features-external-config>>' in
defined order (see '<<spring-boot-features.adoc#boot-features-external-config>>' in
the
``Spring Boot features''
section for the exact order).
the
'`Spring Boot features`'
section for the exact order).
A nice way to augment and modify this is to add `@PropertySource` annotations to your
A nice way to augment and modify this is to add `@PropertySource` annotations to your
application sources. Classes passed to the `SpringApplication` static convenience
application sources. Classes passed to the `SpringApplication` static convenience
...
@@ -156,7 +156,7 @@ You can also provide System properties (or environment variables) to change the
...
@@ -156,7 +156,7 @@ You can also provide System properties (or environment variables) to change the
command line.
command line.
No matter what you set in the environment, Spring Boot will always load
No matter what you set in the environment, Spring Boot will always load
`application.properties` as described above. If YAML is used then files with the
``.yml''
`application.properties` as described above. If YAML is used then files with the
'`.yml`'
extension are also added to the list by default.
extension are also added to the list by default.
See {sc-spring-boot}/context/config/ConfigFileApplicationListener.{sc-ext}[`ConfigFileApplicationListener`]
See {sc-spring-boot}/context/config/ConfigFileApplicationListener.{sc-ext}[`ConfigFileApplicationListener`]
...
@@ -165,7 +165,7 @@ for more detail.
...
@@ -165,7 +165,7 @@ for more detail.
[[howto-use-short-command-line-arguments]]
[[howto-use-short-command-line-arguments]]
=== Use
``short''
command line arguments
=== Use
'`short`'
command line arguments
Some people like to use (for example) `--port=9000` instead of `--server.port=9000` to
Some people like to use (for example) `--port=9000` instead of `--server.port=9000` to
set configuration properties on the command line. You can easily enable this by using
set configuration properties on the command line. You can easily enable this by using
placeholders in `application.properties`, e.g.
placeholders in `application.properties`, e.g.
...
@@ -177,7 +177,7 @@ placeholders in `application.properties`, e.g.
...
@@ -177,7 +177,7 @@ placeholders in `application.properties`, e.g.
TIP: If you are inheriting from the `spring-boot-starter-parent` POM, or if have enabled
TIP: If you are inheriting from the `spring-boot-starter-parent` POM, or if have enabled
maven filtering for the `application.properties` directly, you may want to change the
maven filtering for the `application.properties` directly, you may want to change the
default filter token from `${*}` since it conflicts with those placeholders.
default filter token from `${
\
*}` since it conflicts with those placeholders.
You can either use `@*@` (i.e. `@maven.token@` instead of `${maven.token}`) or you can
You can either use `@*@` (i.e. `@maven.token@` instead of `${maven.token}`) or you can
configure the `maven-resources-plugin` to use
configure the `maven-resources-plugin` to use
http://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#delimiters[other delimiters].
http://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#delimiters[other delimiters].
...
@@ -223,7 +223,7 @@ The example YAML above corresponds to an `application.properties` file
...
@@ -223,7 +223,7 @@ The example YAML above corresponds to an `application.properties` file
----
----
See '<<spring-boot-features.adoc#boot-features-external-config-yaml>>' in
See '<<spring-boot-features.adoc#boot-features-external-config-yaml>>' in
the
``Spring Boot features''
section for more information
the
'`Spring Boot features`'
section for more information
about YAML.
about YAML.
[[howto-set-active-spring-profiles]]
[[howto-set-active-spring-profiles]]
...
@@ -250,7 +250,7 @@ but not by the `SpringApplicationBuilder.profiles()` method. Thus the latter Jav
...
@@ -250,7 +250,7 @@ but not by the `SpringApplicationBuilder.profiles()` method. Thus the latter Jav
be used to augment the profiles without changing the defaults.
be used to augment the profiles without changing the defaults.
See '<<spring-boot-features.adoc#boot-features-profiles>>' in
See '<<spring-boot-features.adoc#boot-features-profiles>>' in
the
``Spring Boot features''
section for more information.
the
'`Spring Boot features`'
section for more information.
...
@@ -285,8 +285,8 @@ Example:
...
@@ -285,8 +285,8 @@ Example:
port: 0
port: 0
----
----
In this example the default port is 9000, but if the Spring profile
``development''
is
In this example the default port is 9000, but if the Spring profile
'`development`'
is
active then the port is 9001, and if
``production''
is active then it is 0.
active then the port is 9001, and if
'`production`'
is active then it is 0.
The YAML documents are merged in the order they are encountered (so later values override
The YAML documents are merged in the order they are encountered (so later values override
earlier ones).
earlier ones).
...
@@ -346,7 +346,7 @@ To switch off the HTTP endpoints completely, but still create a `WebApplicationC
...
@@ -346,7 +346,7 @@ To switch off the HTTP endpoints completely, but still create a `WebApplicationC
use `server.port=-1` (this is sometimes useful for testing).
use `server.port=-1` (this is sometimes useful for testing).
For more details look at '<<spring-boot-features.adoc#boot-features-customizing-embedded-containers>>'
For more details look at '<<spring-boot-features.adoc#boot-features-customizing-embedded-containers>>'
in the
``Spring Boot features'
' section, or the
in the
'`Spring Boot features`
' section, or the
{sc-spring-boot-autoconfigure}/web/ServerProperties.{sc-ext}[`ServerProperties`] source
{sc-spring-boot-autoconfigure}/web/ServerProperties.{sc-ext}[`ServerProperties`] source
code.
code.
...
@@ -366,7 +366,7 @@ that and be sure that it has initialized is to add a `@Bean` of type
...
@@ -366,7 +366,7 @@ that and be sure that it has initialized is to add a `@Bean` of type
out of the event when it is published.
out of the event when it is published.
A really useful thing to do in is to use `@IntegrationTest` to set `server.port=0`
A really useful thing to do in is to use `@IntegrationTest` to set `server.port=0`
and then inject the actual (
``local''
) port as a `@Value`. For example:
and then inject the actual (
'`local`'
) port as a `@Value`. For example:
[source,java,indent=0,subs="verbatim,quotes,attributes"]
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
----
...
@@ -772,45 +772,45 @@ added.
...
@@ -772,45 +772,45 @@ added.
`WebMvcAutoConfiguration` adds the following `ViewResolvers` to your context:
`WebMvcAutoConfiguration` adds the following `ViewResolvers` to your context:
* An `InternalResourceViewResolver` with bean id
``defaultViewResolver''
. This one locates
* An `InternalResourceViewResolver` with bean id
'`defaultViewResolver`'
. This one locates
physical resources that can be rendered using the `DefaultServlet` (e.g. static
physical resources that can be rendered using the `DefaultServlet` (e.g. static
resources and JSP pages if you are using those). It applies a prefix and a suffix to the
resources and JSP pages if you are using those). It applies a prefix and a suffix to the
view name and then looks for a physical resource with that path in the servlet context
view name and then looks for a physical resource with that path in the servlet context
(defaults are both empty, but accessible for external configuration via
(defaults are both empty, but accessible for external configuration via
`spring.view.prefix` and `spring.view.suffix`). It can be overridden by providing a
`spring.view.prefix` and `spring.view.suffix`). It can be overridden by providing a
bean of the same type.
bean of the same type.
* A `BeanNameViewResolver` with id
``beanNameViewResolver''
. This is a useful member of the
* A `BeanNameViewResolver` with id
'`beanNameViewResolver`'
. This is a useful member of the
view resolver chain and will pick up any beans with the same name as the `View` being
view resolver chain and will pick up any beans with the same name as the `View` being
resolved. It shouldn't be necessary to override or replace it.
resolved. It shouldn't be necessary to override or replace it.
* A `ContentNegotiatingViewResolver` with id
``viewResolver''
is only added if there *are*
* A `ContentNegotiatingViewResolver` with id
'`viewResolver`'
is only added if there *are*
actually beans of type `View` present. This is a
``master''
resolver, delegating to all
actually beans of type `View` present. This is a
'`master`'
resolver, delegating to all
the others and attempting to find a match to the
``Accept''
HTTP header sent by the
the others and attempting to find a match to the
'`Accept`'
HTTP header sent by the
client. There is a useful
client. There is a useful
https://spring.io/blog/2013/06/03/content-negotiation-using-views[blog about `ContentNegotiatingViewResolver`]
https://spring.io/blog/2013/06/03/content-negotiation-using-views[blog about `ContentNegotiatingViewResolver`]
that you might like to study to learn more, and also look at the source code for detail.
that you might like to study to learn more, and also look at the source code for detail.
You can switch off the auto-configured
You can switch off the auto-configured
`ContentNegotiatingViewResolver` by defining a bean named
``viewResolver''
.
`ContentNegotiatingViewResolver` by defining a bean named
'`viewResolver`'
.
* If you use Thymeleaf you will also have a `ThymeleafViewResolver` with id
* If you use Thymeleaf you will also have a `ThymeleafViewResolver` with id
``thymeleafViewResolver''
. It looks for resources by surrounding the view name with a
'`thymeleafViewResolver`'
. It looks for resources by surrounding the view name with a
prefix and suffix (externalized to `spring.thymeleaf.prefix` and
prefix and suffix (externalized to `spring.thymeleaf.prefix` and
`spring.thymeleaf.suffix`, defaults
``classpath:/templates/'' and ``.html''
`spring.thymeleaf.suffix`, defaults
'`classpath:/templates/`' and '`.html`'
respectively). It can be overridden by providing a bean of the same name.
respectively). It can be overridden by providing a bean of the same name.
* If you use FreeMarker you will also have a `FreeMarkerViewResolver` with id
* If you use FreeMarker you will also have a `FreeMarkerViewResolver` with id
``freeMarkerViewResolver''
. It looks for resources in a loader path (externalized to
'`freeMarkerViewResolver`'
. It looks for resources in a loader path (externalized to
`spring.freemarker.templateLoaderPath`, default
``classpath:/templates/''
) by
`spring.freemarker.templateLoaderPath`, default
'`classpath:/templates/`'
) by
surrounding the view name with a prefix and suffix (externalized to `spring.freemarker.prefix`
surrounding the view name with a prefix and suffix (externalized to `spring.freemarker.prefix`
and `spring.freemarker.suffix`, with empty and
``.ftl''
defaults respectively). It can
and `spring.freemarker.suffix`, with empty and
'`.ftl`'
defaults respectively). It can
be overridden by providing a bean of the same name.
be overridden by providing a bean of the same name.
* If you use Groovy templates (actually if groovy-templates is on your classpath) you will
* If you use Groovy templates (actually if groovy-templates is on your classpath) you will
also have a `Groovy TemplateViewResolver` with id
``groovyTemplateViewResolver''
. It
also have a `Groovy TemplateViewResolver` with id
'`groovyTemplateViewResolver`'
. It
looks for resources in a loader path by surrounding the view name with a prefix and
looks for resources in a loader path by surrounding the view name with a prefix and
suffix (externalized to `spring.groovy.template.prefix` and
suffix (externalized to `spring.groovy.template.prefix` and
`spring.groovy.template.suffix`, defaults
``classpath:/templates/'' and ``.tpl''
`spring.groovy.template.suffix`, defaults
'`classpath:/templates/`' and '`.tpl`'
respectively). It can be overriden by providing a bean of the same name.
respectively). It can be overriden by providing a bean of the same name.
* If you use Velocity you will also have a `VelocityViewResolver` with id
``velocityViewResolver''
.
* If you use Velocity you will also have a `VelocityViewResolver` with id
'`velocityViewResolver`'
.
It looks for resources in a loader path (externalized to `spring.velocity.resourceLoaderPath`,
It looks for resources in a loader path (externalized to `spring.velocity.resourceLoaderPath`,
default
``classpath:/templates/''
) by surrounding the view name with a prefix and suffix
default
'`classpath:/templates/`'
) by surrounding the view name with a prefix and suffix
(externalized to `spring.velocity.prefix` and `spring.velocity.suffix`, with empty and
``.vm''
(externalized to `spring.velocity.prefix` and `spring.velocity.suffix`, with empty and
'`.vm`'
defaults respectively). It can be overridden by providing a bean of the same name.
defaults respectively). It can be overridden by providing a bean of the same name.
Check out {sc-spring-boot-autoconfigure}/web/WebMvcAutoConfiguration.{sc-ext}[`WebMvcAutoConfiguration`],
Check out {sc-spring-boot-autoconfigure}/web/WebMvcAutoConfiguration.{sc-ext}[`WebMvcAutoConfiguration`],
...
@@ -965,7 +965,7 @@ your own, and bind it to a set of `Environment` properties e.g.
...
@@ -965,7 +965,7 @@ your own, and bind it to a set of `Environment` properties e.g.
----
----
See '<<spring-boot-features.adoc#boot-features-configure-datasource>>' in the
See '<<spring-boot-features.adoc#boot-features-configure-datasource>>' in the
``Spring Boot features''
section and the
'`Spring Boot features`'
section and the
{sc-spring-boot-autoconfigure}/jdbc/DataSourceAutoConfiguration.{sc-ext}[`DataSourceAutoConfiguration`]
{sc-spring-boot-autoconfigure}/jdbc/DataSourceAutoConfiguration.{sc-ext}[`DataSourceAutoConfiguration`]
class for more details.
class for more details.
...
@@ -1063,7 +1063,7 @@ for more details.
...
@@ -1063,7 +1063,7 @@ for more details.
[[howto-use-custom-entity-manager]]
[[howto-use-custom-entity-manager]]
=== Use a custom EntityManagerFactory
=== Use a custom EntityManagerFactory
To take full control of the configuration of the `EntityManagerFactory`, you need to add
To take full control of the configuration of the `EntityManagerFactory`, you need to add
a `@Bean` named
``entityManagerFactory''
. Spring Boot auto-configuration switches off its
a `@Bean` named
'`entityManagerFactory`'
. Spring Boot auto-configuration switches off its
entity manager based on the presence of a bean of that type.
entity manager based on the presence of a bean of that type.
...
@@ -1118,7 +1118,7 @@ might be able to use a JTA transaction manager spanning both.
...
@@ -1118,7 +1118,7 @@ might be able to use a JTA transaction manager spanning both.
Spring doesn't require the use of XML to configure the JPA provider, and Spring Boot
Spring doesn't require the use of XML to configure the JPA provider, and Spring Boot
assumes you want to take advantage of that feature. If you prefer to use `persistence.xml`
assumes you want to take advantage of that feature. If you prefer to use `persistence.xml`
then you need to define your own `@Bean` of type `LocalEntityManagerFactoryBean` (with
then you need to define your own `@Bean` of type `LocalEntityManagerFactoryBean` (with
id
``entityManagerFactory''
, and set the persistence unit name there.
id
'`entityManagerFactory`'
, and set the persistence unit name there.
See
See
https://github.com/spring-projects/spring-boot/blob/master/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration.java[`JpaBaseConfiguration`]
https://github.com/spring-projects/spring-boot/blob/master/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration.java[`JpaBaseConfiguration`]
...
@@ -1134,7 +1134,7 @@ automatically. If they are both present on the classpath, you might have to do s
...
@@ -1134,7 +1134,7 @@ automatically. If they are both present on the classpath, you might have to do s
configuration to tell Spring Boot which one (or both) you want to create repositories for
configuration to tell Spring Boot which one (or both) you want to create repositories for
you. The most explicit way to do that is to use the standard Spring Data
you. The most explicit way to do that is to use the standard Spring Data
`@Enable*Repositories` and tell it the location of your `Repository` interfaces
`@Enable*Repositories` and tell it the location of your `Repository` interfaces
(where
``*'' is ``Jpa'' or ``Mongo''
or both).
(where
'`*`' is '`Jpa`' or '`Mongo`'
or both).
There are also flags `spring.data.*.repositories.enabled` that you can use to switch the
There are also flags `spring.data.*.repositories.enabled` that you can use to switch the
auto-configured repositories on and off in external configuration. This is useful for
auto-configured repositories on and off in external configuration. This is useful for
...
@@ -1173,7 +1173,7 @@ values are `none`, `validate`, `update`, `create-drop`. Spring Boot chooses a de
...
@@ -1173,7 +1173,7 @@ values are `none`, `validate`, `update`, `create-drop`. Spring Boot chooses a de
value for you based on whether it thinks your database is embedded (default `create-drop`)
value for you based on whether it thinks your database is embedded (default `create-drop`)
or not (default `none`). An embedded database is detected by looking at the `Connection`
or not (default `none`). An embedded database is detected by looking at the `Connection`
type: `hsqldb`, `h2` and `derby` are embedded, the rest are not. Be careful when switching
type: `hsqldb`, `h2` and `derby` are embedded, the rest are not. Be careful when switching
from in-memory to a
``real''
database that you don't make assumptions about the existence of
from in-memory to a
'`real`'
database that you don't make assumptions about the existence of
the tables and data in the new platform. You either have to set `ddl-auto` explicitly, or
the tables and data in the new platform. You either have to set `ddl-auto` explicitly, or
use one of the other mechanisms to initialize the database.
use one of the other mechanisms to initialize the database.
...
@@ -1199,7 +1199,7 @@ to start. The script locations can be changed by setting `spring.datasource.sche
...
@@ -1199,7 +1199,7 @@ to start. The script locations can be changed by setting `spring.datasource.sche
To disable the failfast you can set `spring.datasource.continueOnError=true`. This can be
To disable the failfast you can set `spring.datasource.continueOnError=true`. This can be
useful once an application has matured and been deployed a few times, since the scripts
useful once an application has matured and been deployed a few times, since the scripts
can act as
``poor man's migrations''
-- inserts that fail mean that the data is already
can act as
'`poor man's migrations`'
-- inserts that fail mean that the data is already
there, so there would be no need to prevent the application from running, for instance.
there, so there would be no need to prevent the application from running, for instance.
If you want to use the `schema.sql` initialization in a JPA app (with
If you want to use the `schema.sql` initialization in a JPA app (with
...
@@ -1236,7 +1236,7 @@ To automatically run Flyway database migrations on startup, add the
...
@@ -1236,7 +1236,7 @@ To automatically run Flyway database migrations on startup, add the
`org.flywaydb:flyway-core` to your classpath.
`org.flywaydb:flyway-core` to your classpath.
The migrations are scripts in the form `V<VERSION>__<NAME>.sql` (with `<VERSION>` an
The migrations are scripts in the form `V<VERSION>__<NAME>.sql` (with `<VERSION>` an
underscore-separated version, e.g.
``1'' or ``2_1''
). By default they live in a folder
underscore-separated version, e.g.
'`1`' or '`2_1`'
). By default they live in a folder
`classpath:db/migration` but you can modify that using `flyway.locations` (a list). See
`classpath:db/migration` but you can modify that using `flyway.locations` (a list). See
the Flyway class from flyway-core for details of available settings like schemas etc. In
the Flyway class from flyway-core for details of available settings like schemas etc. In
addition Spring Boot provides a small set of properties in
addition Spring Boot provides a small set of properties in
...
@@ -1315,13 +1315,13 @@ For more detail look at the
...
@@ -1315,13 +1315,13 @@ For more detail look at the
{sc-spring-boot-actuator}/autoconfigure/ManagementServerProperties.{sc-ext}[`ManagementServerProperties`]
{sc-spring-boot-actuator}/autoconfigure/ManagementServerProperties.{sc-ext}[`ManagementServerProperties`]
source code and
source code and
'<<production-ready-features.adoc#production-ready-customizing-management-server-port>>'
'<<production-ready-features.adoc#production-ready-customizing-management-server-port>>'
in the
``Production-ready features''
section.
in the
'`Production-ready features`'
section.
[[howto-customize-the-whitelabel-error-page]]
[[howto-customize-the-whitelabel-error-page]]
=== Customize the
``whitelabel''
error page
=== Customize the
'`whitelabel`'
error page
Spring Boot installs a
``whitelabel''
error page that you will see in browser client if
Spring Boot installs a
'`whitelabel`'
error page that you will see in browser client if
you encounter a server error (machine clients consuming JSON and other media types should
you encounter a server error (machine clients consuming JSON and other media types should
see a sensible response with the right error code). To switch it off you can set
see a sensible response with the right error code). To switch it off you can set
`error.whitelabel.enabled=false`, but normally in addition or alternatively to that you
`error.whitelabel.enabled=false`, but normally in addition or alternatively to that you
...
@@ -1530,7 +1530,7 @@ To configure IntelliJ correctly you can use the `idea` Gradle plugin:
...
@@ -1530,7 +1530,7 @@ To configure IntelliJ correctly you can use the `idea` Gradle plugin:
NOTE: Intellij must be configured to use the same Java version as the command line Gradle
NOTE: Intellij must be configured to use the same Java version as the command line Gradle
task and `springloaded` *must* be included as a `buildscript` dependency.
task and `springloaded` *must* be included as a `buildscript` dependency.
You can also additionally enable
``Make Project Automatically''
inside Intellij to
You can also additionally enable
'`Make Project Automatically`'
inside Intellij to
automatically compile your code whenever a file is saved.
automatically compile your code whenever a file is saved.
...
@@ -1568,7 +1568,7 @@ third-party dependencies. Overriding versions may cause compatibility issues.
...
@@ -1568,7 +1568,7 @@ third-party dependencies. Overriding versions may cause compatibility issues.
[[howto-create-an-executable-jar-with-maven]]
[[howto-create-an-executable-jar-with-maven]]
=== Create an executable JAR with Maven
=== Create an executable JAR with Maven
The `spring-boot-maven-plugin` can be used to create an executable
``fat''
JAR. If you
The `spring-boot-maven-plugin` can be used to create an executable
'`fat`'
JAR. If you
are using the `spring-boot-starter-parent` POM you can simply declare the plugin and
are using the `spring-boot-starter-parent` POM you can simply declare the plugin and
your jars will be repackaged:
your jars will be repackaged:
...
@@ -1617,7 +1617,7 @@ If you want to use your project as a library jar for other projects to depend on
...
@@ -1617,7 +1617,7 @@ If you want to use your project as a library jar for other projects to depend on
addition have an executable (e.g. demo) version of it, you will want to configure the
addition have an executable (e.g. demo) version of it, you will want to configure the
build in a slightly different way.
build in a slightly different way.
For Maven the normal JAR plugin and the Spring Boot plugin both have a
``classifier''
For Maven the normal JAR plugin and the Spring Boot plugin both have a
'`classifier`'
configuration that you can add to create an additional JAR. Example (using the Spring
configuration that you can add to create an additional JAR. Example (using the Spring
Boot Starter Parent to manage the plugin versions and other configuration defaults):
Boot Starter Parent to manage the plugin versions and other configuration defaults):
...
@@ -1637,7 +1637,7 @@ Boot Starter Parent to manage the plugin versions and other configuration defaul
...
@@ -1637,7 +1637,7 @@ Boot Starter Parent to manage the plugin versions and other configuration defaul
----
----
Two jars are produced, the default one, and an executable one using the Boot plugin with
Two jars are produced, the default one, and an executable one using the Boot plugin with
classifier
``exec''
.
classifier
'`exec`'
.
For Gradle users the steps are similar. Example:
For Gradle users the steps are similar. Example:
...
@@ -1658,7 +1658,7 @@ jar support which assumes that the `jruby-complete.jar` is always directly avail
...
@@ -1658,7 +1658,7 @@ jar support which assumes that the `jruby-complete.jar` is always directly avail
file in its own right.
file in its own right.
To deal with any problematic libraries, you can flag that specific nested jars should be
To deal with any problematic libraries, you can flag that specific nested jars should be
automatically unpacked to the
``temp folder''
when the executable jar first runs.
automatically unpacked to the
'`temp folder`'
when the executable jar first runs.
For example, to indicate that JRuby should be flagged for unpack using the Maven Plugin
For example, to indicate that JRuby should be flagged for unpack using the Maven Plugin
you would add the following configuration:
you would add the following configuration:
...
@@ -1815,7 +1815,7 @@ archive as normal. To make it executable:
...
@@ -1815,7 +1815,7 @@ archive as normal. To make it executable:
. Use the appropriate launcher as a `Main-Class`, e.g. `JarLauncher` for a jar file, and
. Use the appropriate launcher as a `Main-Class`, e.g. `JarLauncher` for a jar file, and
specify the other properties it needs as manifest entries, principally a `Start-Class`.
specify the other properties it needs as manifest entries, principally a `Start-Class`.
. Add the runtime dependencies in a nested
``lib''
directory (for a jar) and the
. Add the runtime dependencies in a nested
'`lib`'
directory (for a jar) and the
`provided` (embedded container) dependencies in a nested `lib-provided` directory.
`provided` (embedded container) dependencies in a nested `lib-provided` directory.
Remember *not* to compress the entries in the archive.
Remember *not* to compress the entries in the archive.
...
@@ -1868,13 +1868,13 @@ after which you can run the application with
...
@@ -1868,13 +1868,13 @@ after which you can run the application with
Use the `SpringBootServletInitializer` base class, which is picked up by Spring's
Use the `SpringBootServletInitializer` base class, which is picked up by Spring's
Servlet 3.0 support on deployment. Add an extension of that to your project and build a
Servlet 3.0 support on deployment. Add an extension of that to your project and build a
war file as normal. For more detail, see the
war file as normal. For more detail, see the
http://spring.io/guides/gs/convert-jar-to-war[
``Converting a jar Project to a war''
] guide
http://spring.io/guides/gs/convert-jar-to-war[
'`Converting a jar Project to a war`'
] guide
on the spring.io website and the sample below.
on the spring.io website and the sample below.
The war file can also be executable if you use the Spring Boot build tools. In that case
The war file can also be executable if you use the Spring Boot build tools. In that case
the embedded container classes (to launch Tomcat for instance) have to be added to the
the embedded container classes (to launch Tomcat for instance) have to be added to the
war in a `lib-provided` directory. The tools will take care of that as long as the
war in a `lib-provided` directory. The tools will take care of that as long as the
dependencies are marked as
``provided''
in Maven or Gradle. Here's a Maven example
dependencies are marked as
'`provided`'
in Maven or Gradle. Here's a Maven example
{github-code}/spring-boot-samples/spring-boot-sample-traditional/pom.xml[in the Boot Samples].
{github-code}/spring-boot-samples/spring-boot-sample-traditional/pom.xml[in the Boot Samples].
...
...
spring-boot-docs/src/main/asciidoc/production-ready-features.adoc
View file @
6a503d5c
...
@@ -15,7 +15,7 @@ Auditing, health and metrics gathering can be automatically applied to your appl
...
@@ -15,7 +15,7 @@ Auditing, health and metrics gathering can be automatically applied to your appl
== Enabling production-ready features.
== Enabling production-ready features.
The {github-code}/spring-boot-actuator[`spring-boot-actuator`] module provides all of
The {github-code}/spring-boot-actuator[`spring-boot-actuator`] module provides all of
Spring Boot'
s
production
-
ready
features
.
The
simplest
way
to
enable
the
features
is
to
add
Spring Boot'
s
production
-
ready
features
.
The
simplest
way
to
enable
the
features
is
to
add
a
dependency
to
the
`
spring
-
boot
-
starter
-
actuator
`
``
Starter
POM
'
'
.
a
dependency
to
the
`
spring
-
boot
-
starter
-
actuator
`
'`Starter POM`
'
.
.
Definition
of
Actuator
.
Definition
of
Actuator
****
****
...
@@ -24,7 +24,7 @@ controlling something. Actuators can generate a large amount of motion from a sm
...
@@ -24,7 +24,7 @@ controlling something. Actuators can generate a large amount of motion from a sm
change
.
change
.
****
****
To
add
the
actuator
to
a
Maven
based
project
,
add
the
following
``
starter
'
'
To
add
the
actuator
to
a
Maven
based
project
,
add
the
following
'`starter`
'
dependency
:
dependency
:
[
source
,
xml
,
indent
=
0
]
[
source
,
xml
,
indent
=
0
]
...
@@ -66,7 +66,7 @@ The following endpoints are available:
...
@@ -66,7 +66,7 @@ The following endpoints are available:
|`
autoconfig
`
|`
autoconfig
`
|
Displays
an
auto
-
configuration
report
showing
all
auto
-
configuration
candidates
and
the
|
Displays
an
auto
-
configuration
report
showing
all
auto
-
configuration
candidates
and
the
reason
why
they
``
were
''
or
``
were
not
'
'
applied
.
reason
why
they
'`were`'
or
'`were not`
'
applied
.
|
true
|
true
|`
beans
`
|`
beans
`
...
@@ -86,7 +86,7 @@ The following endpoints are available:
...
@@ -86,7 +86,7 @@ The following endpoints are available:
|true
|true
|`health`
|`health`
|Shows application health information (defaulting to a simple
``OK'
' message).
|Shows application health information (defaulting to a simple
'
`
OK
`
' message).
|false
|false
|`info`
|`info`
...
@@ -94,7 +94,7 @@ The following endpoints are available:
...
@@ -94,7 +94,7 @@ The following endpoints are available:
|false
|false
|`metrics`
|`metrics`
|Shows
``metrics'
' information for the current application.
|Shows
'
`
metrics
`
' information for the current application.
|true
|true
|`mappings`
|`mappings`
...
@@ -138,7 +138,7 @@ that is being configured.
...
@@ -138,7 +138,7 @@ that is being configured.
[[production-ready-health]]
[[production-ready-health]]
=== Custom health information
=== Custom health information
The default information exposed by the `health` endpoint is a simple
``OK'
' message. It
The default information exposed by the `health` endpoint is a simple
'
`
OK
`
' message. It
is often useful to perform some additional health checks, for example you might check
is often useful to perform some additional health checks, for example you might check
that a database connection works, or that a remote REST endpoint is functioning.
that a database connection works, or that a remote REST endpoint is functioning.
...
@@ -220,7 +220,7 @@ filtering. In your `pom.xml` you have (inside the `<build/>` element):
...
@@ -220,7 +220,7 @@ filtering. In your `pom.xml` you have (inside the `<build/>` element):
</
resources
>
</
resources
>
----
----
You
can
then
refer
to
your
Maven
``
project
properties
'
'
via
placeholders
,
e
.
g
.
You
can
then
refer
to
your
Maven
'`project properties`
'
via
placeholders
,
e
.
g
.
[
source
,
properties
,
indent
=
0
]
[
source
,
properties
,
indent
=
0
]
----
----
...
@@ -299,12 +299,12 @@ all non-sensitive endpoints to be exposed over HTTP. The default convention is t
...
@@ -299,12 +299,12 @@ all non-sensitive endpoints to be exposed over HTTP. The default convention is t
[[
production
-
ready
-
sensitive
-
endpoints
]]
[[
production
-
ready
-
sensitive
-
endpoints
]]
===
Exposing
sensitive
endpoints
===
Exposing
sensitive
endpoints
If
you
use
``
Spring
Security
'
'
sensitive
endpoints
will
be
exposed
over
HTTP
,
but
also
If
you
use
'`Spring Security`
'
sensitive
endpoints
will
be
exposed
over
HTTP
,
but
also
protected
.
By
default
``
basic
'
'
authentication
will
be
used
with
the
username
`
user
`
protected
.
By
default
'`basic`
'
authentication
will
be
used
with
the
username
`
user
`
and
a
generated
password
(
which
is
printed
on
the
console
when
the
application
starts
).
and
a
generated
password
(
which
is
printed
on
the
console
when
the
application
starts
).
TIP
:
Generated
passwords
are
logged
as
the
application
starts
.
Search
for
`
`
Using
default
TIP
:
Generated
passwords
are
logged
as
the
application
starts
.
Search
for
'
`Using default
security
password
'
'
.
security password
`
'
.
You
can
use
Spring
properties
to
change
the
username
and
password
and
to
change
the
You
can
use
Spring
properties
to
change
the
username
and
password
and
to
change
the
security
role
required
to
access
the
endpoints
.
For
example
,
you
might
set
the
following
security
role
required
to
access
the
endpoints
.
For
example
,
you
might
set
the
following
...
@@ -480,7 +480,7 @@ If you are using Jolokia but you don't want Spring Boot to configure it, simply
...
@@ -480,7 +480,7 @@ If you are using Jolokia but you don't want Spring Boot to configure it, simply
[[
production
-
ready
-
remote
-
shell
]]
[[
production
-
ready
-
remote
-
shell
]]
==
Monitoring
and
management
using
a
remote
shell
==
Monitoring
and
management
using
a
remote
shell
Spring
Boot
supports
an
integrated
Java
shell
called
``
CRaSH
'
'
.
You
can
use
CRaSH
to
Spring
Boot
supports
an
integrated
Java
shell
called
'`CRaSH`
'
.
You
can
use
CRaSH
to
`
ssh
`
or
`
telnet
`
into
your
running
application
.
To
enable
remote
shell
support
add
a
`
ssh
`
or
`
telnet
`
into
your
running
application
.
To
enable
remote
shell
support
add
a
dependency
to
`
spring
-
boot
-
starter
-
remote
-
shell
`:
dependency
to
`
spring
-
boot
-
starter
-
remote
-
shell
`:
...
@@ -536,7 +536,7 @@ and `endpoint` commands.
...
@@ -536,7 +536,7 @@ and `endpoint` commands.
====
Remote
shell
credentials
====
Remote
shell
credentials
You
can
use
the
`
shell
.
auth
.
simple
.
user
.
name
`
and
`
shell
.
auth
.
simple
.
user
.
password
`
properties
You
can
use
the
`
shell
.
auth
.
simple
.
user
.
name
`
and
`
shell
.
auth
.
simple
.
user
.
password
`
properties
to
configure
custom
connection
credentials
.
It
is
also
possible
to
use
a
to
configure
custom
connection
credentials
.
It
is
also
possible
to
use
a
``
Spring
Security
'
'
`
AuthenticationManager
`
to
handle
login
duties
.
See
the
'`Spring Security`
'
`
AuthenticationManager
`
to
handle
login
duties
.
See
the
{
dc
-
spring
-
boot
-
actuator
}/
autoconfigure
/
CrshAutoConfiguration
.{
dc
-
ext
}[`
CrshAutoConfiguration
`]
{
dc
-
spring
-
boot
-
actuator
}/
autoconfigure
/
CrshAutoConfiguration
.{
dc
-
ext
}[`
CrshAutoConfiguration
`]
and
{
dc
-
spring
-
boot
-
actuator
}/
autoconfigure
/
ShellProperties
.{
dc
-
ext
}[`
ShellProperties
`]
and
{
dc
-
spring
-
boot
-
actuator
}/
autoconfigure
/
ShellProperties
.{
dc
-
ext
}[`
ShellProperties
`]
Javadoc
for
full
details
.
Javadoc
for
full
details
.
...
@@ -559,7 +559,7 @@ for details). By default Spring Boot will search for commands in the following l
...
@@ -559,7 +559,7 @@ for details). By default Spring Boot will search for commands in the following l
TIP
:
You
can
change
the
search
path
by
settings
a
`
shell
.
commandPathPatterns
`
property
.
TIP
:
You
can
change
the
search
path
by
settings
a
`
shell
.
commandPathPatterns
`
property
.
Here
is
a
simple
``
hello
world
'
'
command
that
could
be
loaded
from
Here
is
a
simple
'`hello world`
'
command
that
could
be
loaded
from
`
src
/
main
/
resources
/
commands
/
hello
.
groovy
`
`
src
/
main
/
resources
/
commands
/
hello
.
groovy
`
[
source
,
groovy
,
indent
=
0
]
[
source
,
groovy
,
indent
=
0
]
...
@@ -615,8 +615,8 @@ documentation].
...
@@ -615,8 +615,8 @@ documentation].
[[
production
-
ready
-
metrics
]]
[[
production
-
ready
-
metrics
]]
==
Metrics
==
Metrics
Spring
Boot
Actuator
includes
a
metrics
service
with
``
gauge
''
and
``
counter
'
'
support
.
Spring
Boot
Actuator
includes
a
metrics
service
with
'`gauge`'
and
'`counter`
'
support
.
A
``
gauge
''
records
a
single
value
;
and
a
``
counter
'
'
records
a
delta
(
an
increment
or
A
'`gauge`'
records
a
single
value
;
and
a
'`counter`
'
records
a
delta
(
an
increment
or
decrement
).
Metrics
for
all
HTTP
requests
are
automatically
recorded
,
so
if
you
hit
the
decrement
).
Metrics
for
all
HTTP
requests
are
automatically
recorded
,
so
if
you
hit
the
`
metrics
`
endpoint
should
should
see
a
response
similar
to
this
:
`
metrics
`
endpoint
should
should
see
a
response
similar
to
this
:
...
@@ -648,7 +648,7 @@ decrement). Metrics for all HTTP requests are automatically recorded, so if you
...
@@ -648,7 +648,7 @@ decrement). Metrics for all HTTP requests are automatically recorded, so if you
----
----
Here
we
can
see
basic
`
memory
`,
`
heap
`,
`
class
loading
`,
`
processor
`
and
`
thread
pool
`
Here
we
can
see
basic
`
memory
`,
`
heap
`,
`
class
loading
`,
`
processor
`
and
`
thread
pool
`
information
along
with
some
HTTP
metrics
.
In
this
instance
the
`
root
`
(
``/
'
'
)
and
`/
metrics
`
information
along
with
some
HTTP
metrics
.
In
this
instance
the
`
root
`
(
'`/`
'
)
and
`/
metrics
`
URLs
have
returned
`
HTTP
200
`
responses
`
20
`
and
`
3
`
times
respectively
.
It
also
appears
URLs
have
returned
`
HTTP
200
`
responses
`
20
`
and
`
3
`
times
respectively
.
It
also
appears
that
the
`
root
`
URL
returned
`
HTTP
401
`
(
unauthorized
)
`
4
`
times
.
The
double
asterix
(`
star
-
star
`)
that
the
`
root
`
URL
returned
`
HTTP
401
`
(
unauthorized
)
`
4
`
times
.
The
double
asterix
(`
star
-
star
`)
comes
from
a
request
matched
by
Spring
MVC
as
`/**`
(
normally
a
static
resource
).
comes
from
a
request
matched
by
Spring
MVC
as
`/**`
(
normally
a
static
resource
).
...
@@ -722,22 +722,22 @@ an `Exporter` interface and a few basic implementations for you to get started w
...
@@ -722,22 +722,22 @@ an `Exporter` interface and a few basic implementations for you to get started w
[[
production
-
ready
-
code
-
hale
-
metrics
]]
[[
production
-
ready
-
code
-
hale
-
metrics
]]
===
Coda
Hale
Metrics
===
Coda
Hale
Metrics
User
of
the
http
://
metrics
.
codahale
.
com
/[
Coda
Hale
``
Metrics
'
'
library
]
will
automatically
User
of
the
http
://
metrics
.
codahale
.
com
/[
Coda
Hale
'`Metrics`
'
library
]
will
automatically
find
that
Spring
Boot
metrics
are
published
to
`
com
.
codahale
.
metrics
.
MetricRegistry
`.
A
find
that
Spring
Boot
metrics
are
published
to
`
com
.
codahale
.
metrics
.
MetricRegistry
`.
A
default
`
com
.
codahale
.
metrics
.
MetricRegistry
`
Spring
bean
will
be
created
when
you
declare
default
`
com
.
codahale
.
metrics
.
MetricRegistry
`
Spring
bean
will
be
created
when
you
declare
a
dependency
to
the
`
com
.
codahale
.
metrics
:
metrics
-
core
`
library
;
you
can
also
register
you
a
dependency
to
the
`
com
.
codahale
.
metrics
:
metrics
-
core
`
library
;
you
can
also
register
you
own
`@
Bean
`
instance
if
you
need
customizations
.
own
`@
Bean
`
instance
if
you
need
customizations
.
Users
can
create
Coda
Hale
metrics
by
prefixing
their
metric
names
with
the
appropriate
Users
can
create
Coda
Hale
metrics
by
prefixing
their
metric
names
with
the
appropriate
type
(
e
.
g
.
`
histogram
.
*`,
`
meter
.
*`).
type
(
e
.
g
.
`
histogram
.
\*`,
`
meter
.\
*`).
[[
production
-
ready
-
metrics
-
message
-
channel
-
integration
]]
[[
production
-
ready
-
metrics
-
message
-
channel
-
integration
]]
===
Message
channel
integration
===
Message
channel
integration
If
the
``
Spring
Messaging
'
'
jar
is
on
your
classpath
a
`
MessageChannel
`
called
If
the
'`Spring Messaging`
'
jar
is
on
your
classpath
a
`
MessageChannel
`
called
`
metricsChannel
`
is
automatically
created
(
unless
one
already
exists
).
All
metric
update
`
metricsChannel
`
is
automatically
created
(
unless
one
already
exists
).
All
metric
update
events
are
additionally
published
as
``
messages
'
'
on
that
channel
.
Additional
analysis
or
events
are
additionally
published
as
'`messages`
'
on
that
channel
.
Additional
analysis
or
actions
can
be
taken
by
clients
subscribing
to
that
channel
.
actions
can
be
taken
by
clients
subscribing
to
that
channel
.
...
@@ -745,7 +745,7 @@ actions can be taken by clients subscribing to that channel.
...
@@ -745,7 +745,7 @@ actions can be taken by clients subscribing to that channel.
[[
production
-
ready
-
auditing
]]
[[
production
-
ready
-
auditing
]]
==
Auditing
==
Auditing
Spring
Boot
Actuator
has
a
flexible
audit
framework
that
will
publish
events
once
Spring
Spring
Boot
Actuator
has
a
flexible
audit
framework
that
will
publish
events
once
Spring
Security
is
in
play
(
``
authentication
success
''
,
``
failure
''
and
``
access
denied
'
'
Security
is
in
play
(
'`authentication success`'
,
'`failure`'
and
'`access denied`
'
exceptions
by
default
).
This
can
be
very
useful
for
reporting
,
and
also
to
implement
a
exceptions
by
default
).
This
can
be
very
useful
for
reporting
,
and
also
to
implement
a
lock
-
out
policy
based
on
authentication
failures
.
lock
-
out
policy
based
on
authentication
failures
.
...
@@ -844,6 +844,6 @@ look at the actuator {github-code}/spring-boot-samples[sample applications]. You
...
@@ -844,6 +844,6 @@ look at the actuator {github-code}/spring-boot-samples[sample applications]. You
might want to read about graphing tools such as http://graphite.wikidot.com/[Graphite].
might want to read about graphing tools such as http://graphite.wikidot.com/[Graphite].
Otherwise, you can continue on, to read about <<cloud-deployment.adoc#cloud-deployment,
Otherwise, you can continue on, to read about <<cloud-deployment.adoc#cloud-deployment,
``cloud deployment options'
'>> or jump ahead
'
`
cloud
deployment
options
`
'>> or jump ahead
for some in depth information about Spring Boot'
s
for some in depth information about Spring Boot'
s
'<<build-tool-plugins.adoc#build-tool-plugins, build tool plugins>>'
.
'<<build-tool-plugins.adoc#build-tool-plugins, build tool plugins>>'
.
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
View file @
6a503d5c
...
@@ -83,7 +83,7 @@ For a complete list of the configuration options, see the
...
@@ -83,7 +83,7 @@ For a complete list of the configuration options, see the
[[boot-features-fluent-builder-api]]
[[boot-features-fluent-builder-api]]
=== Fluent builder API
=== Fluent builder API
If you need to build an `ApplicationContext` hierarchy (multiple contexts with a
If you need to build an `ApplicationContext` hierarchy (multiple contexts with a
parent/child relationship), or if you just prefer using a
``fluent'
' builder API, you
parent/child relationship), or if you just prefer using a
'`fluent`
' builder API, you
can use the `SpringApplicationBuilder`.
can use the `SpringApplicationBuilder`.
The `SpringApplicationBuilder` allows you to chain together multiple method calls, and
The `SpringApplicationBuilder` allows you to chain together multiple method calls, and
...
@@ -139,7 +139,7 @@ your behalf. By default, an `AnnotationConfigApplicationContext` or
...
@@ -139,7 +139,7 @@ your behalf. By default, an `AnnotationConfigApplicationContext` or
`AnnotationConfigEmbeddedWebApplicationContext` will be used, depending on whether you
`AnnotationConfigEmbeddedWebApplicationContext` will be used, depending on whether you
are developing a web application or not.
are developing a web application or not.
The algorithm used to determine a
``web environment'
' is fairly simplistic (based on the
The algorithm used to determine a
'`web environment`
' is fairly simplistic (based on the
presence of a few classes). You can use `setWebEnvironment(boolean webEnvironment)` if
presence of a few classes). You can use `setWebEnvironment(boolean webEnvironment)` if
you need to override the default.
you need to override the default.
...
@@ -259,7 +259,7 @@ value and `max` is the maximum (exclusive).
...
@@ -259,7 +259,7 @@ value and `max` is the maximum (exclusive).
[[boot-features-external-config-command-line-args]]
[[boot-features-external-config-command-line-args]]
=== Accessing command line properties
=== Accessing command line properties
By default `SpringApplication` will convert any command line option arguments (starting
By default `SpringApplication` will convert any command line option arguments (starting
with
``--'
', e.g. `--server.port=9000`) to a `property` and add it to the Spring
with
'`--`
', e.g. `--server.port=9000`) to a `property` and add it to the Spring
`Environment`. As mentioned above, command line properties always take precedence over
`Environment`. As mentioned above, command line properties always take precedence over
other property sources.
other property sources.
...
@@ -340,7 +340,7 @@ properties).
...
@@ -340,7 +340,7 @@ properties).
app.description=${app.name} is a Spring Boot application
app.description=${app.name} is a Spring Boot application
----
----
TIP: You can also use this technique to create
``short'
' variants of existing Spring Boot
TIP: You can also use this technique to create
'`short`
' variants of existing Spring Boot
properties. See the '<<howto.adoc#howto-use-short-command-line-arguments>>' how-to
properties. See the '<<howto.adoc#howto-use-short-command-line-arguments>>' how-to
for details.
for details.
...
@@ -353,7 +353,7 @@ for specifying hierarchical configuration data. The `SpringApplication` class wi
...
@@ -353,7 +353,7 @@ for specifying hierarchical configuration data. The `SpringApplication` class wi
automatically support YAML as an alternative to properties whenever you have the
automatically support YAML as an alternative to properties whenever you have the
http://code.google.com/p/snakeyaml/[SnakeYAML] library on your classpath.
http://code.google.com/p/snakeyaml/[SnakeYAML] library on your classpath.
NOTE: If you use
``starter POMs'
' SnakeYAML will be automatically provided via
NOTE: If you use
'`starter POMs`
' SnakeYAML will be automatically provided via
`spring-boot-starter`.
`spring-boot-starter`.
...
@@ -675,7 +675,7 @@ http://logging.apache.org/log4j/[Log4J] and
...
@@ -675,7 +675,7 @@ http://logging.apache.org/log4j/[Log4J] and
http://logback.qos.ch/[Logback].
http://logback.qos.ch/[Logback].
In each case there is console output and file output (rotating, 10 Mb file size).
In each case there is console output and file output (rotating, 10 Mb file size).
By default, If you use the
``Starter POMs'
', Logback will be used for logging. Appropriate
By default, If you use the
'`Starter POMs`
', Logback will be used for logging. Appropriate
Logback routing is also included to ensure that dependent libraries that use
Logback routing is also included to ensure that dependent libraries that use
Java Util Logging, Commons Logging, Log4J or SLF4J will all work correctly.
Java Util Logging, Commons Logging, Log4J or SLF4J will all work correctly.
...
@@ -737,8 +737,8 @@ As with console output, `ERROR`, `WARN` and `INFO` level messages are logged by
...
@@ -737,8 +737,8 @@ As with console output, `ERROR`, `WARN` and `INFO` level messages are logged by
=== Log Levels
=== Log Levels
All the supported logging systems can have the logger levels set in the Spring
All the supported logging systems can have the logger levels set in the Spring
`Environment` (so for example in `application.properties`) using
``logging.level.*=LEVEL'
'
`Environment` (so for example in `application.properties`) using
'`logging.level.*=LEVEL`
'
where
``LEVEL'
' is one of TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF. Example
where
'`LEVEL`
' is one of TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF. Example
`application.properties`:
`application.properties`:
[source,properties,indent=0,subs="verbatim,quotes,attributes"]
[source,properties,indent=0,subs="verbatim,quotes,attributes"]
...
@@ -799,7 +799,7 @@ All the logging systems supported can consult System properties when parsing the
...
@@ -799,7 +799,7 @@ All the logging systems supported can consult System properties when parsing the
configuration files. See the default configurations in `spring-boot.jar` for examples.
configuration files. See the default configurations in `spring-boot.jar` for examples.
WARNING: There are know classloading issues with Java Util Logging that cause problems
WARNING: There are know classloading issues with Java Util Logging that cause problems
when running from an
``executable jar'
'. We recommend that you avoid it if at all
when running from an
'`executable jar`
'. We recommend that you avoid it if at all
possible.
possible.
...
@@ -817,9 +817,9 @@ If you haven't yet developed a Spring Boot web application you can follow the
...
@@ -817,9 +817,9 @@ If you haven't yet developed a Spring Boot web application you can follow the
[[boot-features-spring-mvc]]
[[boot-features-spring-mvc]]
=== The
``Spring Web MVC framework'
'
=== The
'`Spring Web MVC framework`
'
The Spring Web MVC framework (often referred to as simply
``Spring MVC'
') is a rich
The Spring Web MVC framework (often referred to as simply
'`Spring MVC`
') is a rich
``model view controller'
' web framework. Spring MVC lets you create special `@Controller`
'`model view controller`
' web framework. Spring MVC lets you create special `@Controller`
or `@RestController` beans to handle incoming HTTP requests. Methods in your controller
or `@RestController` beans to handle incoming HTTP requests. Methods in your controller
are mapped to HTTP using `@RequestMapping` annotations.
are mapped to HTTP using `@RequestMapping` annotations.
...
@@ -928,7 +928,7 @@ Spring decides not to handle it. Most of the time this will not happen (unless y
...
@@ -928,7 +928,7 @@ Spring decides not to handle it. Most of the time this will not happen (unless y
the default MVC configuration) because Spring will always be able to handle requests
the default MVC configuration) because Spring will always be able to handle requests
through the `DispatcherServlet`.
through the `DispatcherServlet`.
In addition to the
``standard'
' static resource locations above, a special case is made for
In addition to the
'`standard`
' static resource locations above, a special case is made for
http://www.webjars.org/[Webjars content]. Any resources with a path in `/webjars/**` will
http://www.webjars.org/[Webjars content]. Any resources with a path in `/webjars/**` will
be served from jar files if they are packaged in the Webjars format.
be served from jar files if they are packaged in the Webjars format.
...
@@ -964,11 +964,11 @@ servlet containers.
...
@@ -964,11 +964,11 @@ servlet containers.
[[boot-features-error-handling]]
[[boot-features-error-handling]]
==== Error Handling
==== Error Handling
Spring Boot provides an `/error` mapping by default that handles all errors in a
Spring Boot provides an `/error` mapping by default that handles all errors in a
sensible way, and it is registered as a
``global'
' error page in the servlet container.
sensible way, and it is registered as a
'`global`
' error page in the servlet container.
For machine clients it will produce a JSON response with details of the error, the HTTP
For machine clients it will produce a JSON response with details of the error, the HTTP
status and the exception message. For browser clients there is a
``whitelabel'
' error
status and the exception message. For browser clients there is a
'`whitelabel`
' error
view that renders the same data in HTML format (to customize it just add a `View` that
view that renders the same data in HTML format (to customize it just add a `View` that
resolves to
``error'
'). To replace the default behaviour completely you can implement
resolves to
'`error`
'). To replace the default behaviour completely you can implement
`ErrorController` and register a bean definition of that type, or simply add a bean
`ErrorController` and register a bean definition of that type, or simply add a bean
of type `ErrorAttributes` to use the existing mechanism but replace the contents.
of type `ErrorAttributes` to use the existing mechanism but replace the contents.
...
@@ -1032,7 +1032,7 @@ behaviour by setting `com.ibm.ws.webcontainer.invokeFlushAfterService` to `false
...
@@ -1032,7 +1032,7 @@ behaviour by setting `com.ibm.ws.webcontainer.invokeFlushAfterService` to `false
[[boot-features-embedded-container]]
[[boot-features-embedded-container]]
=== Embedded servlet container support
=== Embedded servlet container support
Spring Boot includes support for embedded Tomcat and Jetty servers. Most developers will
Spring Boot includes support for embedded Tomcat and Jetty servers. Most developers will
simply use the appropriate
``Starter POM'
' to obtain a fully configured instance. By
simply use the appropriate
'`Starter POM`
' to obtain a fully configured instance. By
default both Tomcat and Jetty will listen for HTTP requests on port `8080`.
default both Tomcat and Jetty will listen for HTTP requests on port `8080`.
...
@@ -1130,7 +1130,7 @@ yourself.
...
@@ -1130,7 +1130,7 @@ yourself.
----
----
Setters are provided for many configuration options. Several protected method
Setters are provided for many configuration options. Several protected method
``hooks'
' are also provided should you need to do something more exotic. See the
'`hooks`
' are also provided should you need to do something more exotic. See the
source code documentation for details.
source code documentation for details.
...
@@ -1154,12 +1154,12 @@ you can see how to set things up.
...
@@ -1154,12 +1154,12 @@ you can see how to set things up.
[[boot-features-security]]
[[boot-features-security]]
== Security
== Security
If Spring Security is on the classpath then web applications will be secure by default
If Spring Security is on the classpath then web applications will be secure by default
with
``basic'
' authentication on all HTTP endpoints. To add method-level security to a web
with
'`basic`
' authentication on all HTTP endpoints. To add method-level security to a web
application you can also add `@EnableGlobalMethodSecurity` with your desired settings.
application you can also add `@EnableGlobalMethodSecurity` with your desired settings.
Additional information can be found in the {spring-security-reference}#jc-method[Spring
Additional information can be found in the {spring-security-reference}#jc-method[Spring
Security Reference].
Security Reference].
The default `AuthenticationManager` has a single user (
``user'
' username and random
The default `AuthenticationManager` has a single user (
'`user`
' username and random
password, printed at INFO level when the application starts up)
password, printed at INFO level when the application starts up)
[indent=0]
[indent=0]
...
@@ -1186,8 +1186,8 @@ The basic features you get out of the box in a web application are:
...
@@ -1186,8 +1186,8 @@ The basic features you get out of the box in a web application are:
* An `AuthenticationManager` bean with in-memory store and a single user (see
* An `AuthenticationManager` bean with in-memory store and a single user (see
`SecurityProperties.User` for the properties of the user).
`SecurityProperties.User` for the properties of the user).
* Ignored (unsecure) paths for common static resource locations (`/css/
**`, `/js/*
*`,
* Ignored (unsecure) paths for common static resource locations (`/css/
\*\*`, `/js/\*\
*`,
`/images/
**` and `*
*/favicon.ico`).
`/images/
\*\*` and `\*\
*/favicon.ico`).
* HTTP Basic security for all other endpoints.
* HTTP Basic security for all other endpoints.
* Security events published to Spring's `ApplicationEventPublisher` (successful and
* Security events published to Spring's `ApplicationEventPublisher` (successful and
unsuccessful authentication and access denied).
unsuccessful authentication and access denied).
...
@@ -1218,7 +1218,7 @@ if you _do_ want to override the actuator access rules.
...
@@ -1218,7 +1218,7 @@ if you _do_ want to override the actuator access rules.
[[boot-features-sql]]
[[boot-features-sql]]
== Working with SQL databases
== Working with SQL databases
The Spring Framework provides extensive support for working with SQL databases. From
The Spring Framework provides extensive support for working with SQL databases. From
direct JDBC access using `JdbcTemplate` to complete
``object relational mapping'
'
direct JDBC access using `JdbcTemplate` to complete
'`object relational mapping`
'
technologies such as Hibernate. Spring Data provides an additional level of functionality,
technologies such as Hibernate. Spring Data provides an additional level of functionality,
creating `Repository` implementations directly from interfaces and using conventions to
creating `Repository` implementations directly from interfaces and using conventions to
generate queries from your method names.
generate queries from your method names.
...
@@ -1240,7 +1240,7 @@ Obviously, in-memory databases do not provide persistent storage; you will need
...
@@ -1240,7 +1240,7 @@ Obviously, in-memory databases do not provide persistent storage; you will need
populate your database when your application starts and be prepared to throw away
populate your database when your application starts and be prepared to throw away
data when your application ends.
data when your application ends.
TIP: The
``How-to'
' section includes a '<<howto.adoc#howto-database-initialization, section
TIP: The
'`How-to`
' section includes a '<<howto.adoc#howto-database-initialization, section
on how to initialize a database>>'
on how to initialize a database>>'
Spring Boot can auto-configure embedded http://www.h2database.com[H2],
Spring Boot can auto-configure embedded http://www.h2database.com[H2],
...
@@ -1279,7 +1279,7 @@ Production database connections can also be auto-configured using a pooling
...
@@ -1279,7 +1279,7 @@ Production database connections can also be auto-configured using a pooling
* If commons-dbcp is available we will use that, but we don't recommend it in production.
* If commons-dbcp is available we will use that, but we don't recommend it in production.
If you use the `spring-boot-starter-jdbc` or `spring-boot-starter-data-jpa`
If you use the `spring-boot-starter-jdbc` or `spring-boot-starter-data-jpa`
``starter POMs'
' you will automcatically get a dependency to `tomcat-jdbc`.
'`starter POMs`
' you will automcatically get a dependency to `tomcat-jdbc`.
NOTE: Additional connection pools can always be configured manually. If you define your
NOTE: Additional connection pools can always be configured manually. If you define your
own `DataSource` bean, auto-configuration will not occur.
own `DataSource` bean, auto-configuration will not occur.
...
@@ -1333,8 +1333,8 @@ you can `@Autowire` them directly into your own beans:
...
@@ -1333,8 +1333,8 @@ you can `@Autowire` them directly into your own beans:
[[boot-features-jpa-and-spring-data]]
[[boot-features-jpa-and-spring-data]]
=== JPA and
``Spring Data'
'
=== JPA and
'`Spring Data`
'
The Java Persistence API is a standard technology that allows you to
``map'
' objects to
The Java Persistence API is a standard technology that allows you to
'`map`
' objects to
relational databases. The `spring-boot-starter-data-jpa` POM provides a quick way to get
relational databases. The `spring-boot-starter-data-jpa` POM provides a quick way to get
started. It provides the following key dependencies:
started. It provides the following key dependencies:
...
@@ -1343,7 +1343,7 @@ started. It provides the following key dependencies:
...
@@ -1343,7 +1343,7 @@ started. It provides the following key dependencies:
* Spring ORMs -- Core ORM support from the Spring Framework.
* Spring ORMs -- Core ORM support from the Spring Framework.
TIP: We won't go into too many details of JPA or Spring Data here. You can follow the
TIP: We won't go into too many details of JPA or Spring Data here. You can follow the
http://spring.io/guides/gs/accessing-data-jpa/[
``Accessing Data with JPA'
'] guide from
http://spring.io/guides/gs/accessing-data-jpa/[
'`Accessing Data with JPA`
'] guide from
http://spring.io and read the http://projects.spring.io/spring-data-jpa/[Spring Data JPA]
http://spring.io and read the http://projects.spring.io/spring-data-jpa/[Spring Data JPA]
and http://hibernate.org/orm/documentation/[Hibernate] reference documentation.
and http://hibernate.org/orm/documentation/[Hibernate] reference documentation.
...
@@ -1351,8 +1351,8 @@ and http://hibernate.org/orm/documentation/[Hibernate] reference documentation.
...
@@ -1351,8 +1351,8 @@ and http://hibernate.org/orm/documentation/[Hibernate] reference documentation.
[[boot-features-entity-classes]]
[[boot-features-entity-classes]]
==== Entity Classes
==== Entity Classes
Traditionally, JPA
``Entity'
' classes are specified in a `persistence.xml` file. With
Traditionally, JPA
'`Entity`
' classes are specified in a `persistence.xml` file. With
Spring Boot this file is not necessary and instead
``Entity Scanning'
' is used. By
Spring Boot this file is not necessary and instead
'`Entity Scanning`
' is used. By
default all packages below your main configuration class (the one annotated with
default all packages below your main configuration class (the one annotated with
`@EnableAutoConfiguration`) will be searched.
`@EnableAutoConfiguration`) will be searched.
...
@@ -1504,7 +1504,7 @@ http://redis.io/[Redis] is a cache, message broker and richly-featured key-value
...
@@ -1504,7 +1504,7 @@ http://redis.io/[Redis] is a cache, message broker and richly-featured key-value
Spring Boot offers basic auto-configuration for the https://github.com/xetorthio/jedis/[Jedis]
Spring Boot offers basic auto-configuration for the https://github.com/xetorthio/jedis/[Jedis]
client library and abstractions on top of it provided by
client library and abstractions on top of it provided by
https://github.com/spring-projects/spring-data-redis[Spring Data Redis]. There is a
https://github.com/spring-projects/spring-data-redis[Spring Data Redis]. There is a
`spring-boot-starter-redis`
``Starter POM'
' for collecting the dependencies in a
`spring-boot-starter-redis`
'`Starter POM`
' for collecting the dependencies in a
convenient way.
convenient way.
...
@@ -1534,7 +1534,7 @@ instance will attempt to connect to a Redis server using `localhost:6379`:
...
@@ -1534,7 +1534,7 @@ instance will attempt to connect to a Redis server using `localhost:6379`:
If you add a `@Bean` of your own of any of the auto-configured types it will replace the
If you add a `@Bean` of your own of any of the auto-configured types it will replace the
default (except in the case of `RedisTemplate` the exclusion is based on the bean name
default (except in the case of `RedisTemplate` the exclusion is based on the bean name
``redisTemplate'
' not its type). If `commons-pool2` is on the classpath you will get a
'`redisTemplate`
' not its type). If `commons-pool2` is on the classpath you will get a
pooled connection factory by default.
pooled connection factory by default.
...
@@ -1544,7 +1544,7 @@ pooled connection factory by default.
...
@@ -1544,7 +1544,7 @@ pooled connection factory by default.
http://www.mongodb.com/[MongoDB] is an open-source NoSQL document database that uses a
http://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
JSON-like schema instead of traditional table-based relational data. Spring Boot offers
several conveniences for working with MongoDB, including the The
several conveniences for working with MongoDB, including the The
`spring-boot-starter-data-mongodb`
``Starter POM'
'.
`spring-boot-starter-data-mongodb`
'`Starter POM`
'.
...
@@ -1659,7 +1659,7 @@ documentation].
...
@@ -1659,7 +1659,7 @@ documentation].
=== Gemfire
=== Gemfire
https://github.com/spring-projects/spring-data-gemfire[Spring Data Gemfire] provides
https://github.com/spring-projects/spring-data-gemfire[Spring Data Gemfire] provides
convenient Spring-friendly tools for accessing the http://www.gopivotal.com/big-data/pivotal-gemfire#details[Pivotal Gemfire]
convenient Spring-friendly tools for accessing the http://www.gopivotal.com/big-data/pivotal-gemfire#details[Pivotal Gemfire]
data management platform. There is a `spring-boot-starter-data-gemfire`
``Starter POM'
'
data management platform. There is a `spring-boot-starter-data-gemfire`
'`Starter POM`
'
for collecting the dependencies in a convenient way. There is currently no auto=config
for collecting the dependencies in a convenient way. There is currently no auto=config
support for Gemfire, but you can enable Spring Data Repositories with a
support for Gemfire, but you can enable Spring Data Repositories with a
https://github.com/spring-projects/spring-data-gemfire/blob/master/src/main/java/org/springframework/data/gemfire/repository/config/EnableGemfireRepositories.java[single annotation].
https://github.com/spring-projects/spring-data-gemfire/blob/master/src/main/java/org/springframework/data/gemfire/repository/config/EnableGemfireRepositories.java[single annotation].
...
@@ -1671,7 +1671,7 @@ https://github.com/spring-projects/spring-data-gemfire/blob/master/src/main/java
...
@@ -1671,7 +1671,7 @@ https://github.com/spring-projects/spring-data-gemfire/blob/master/src/main/java
http://lucene.apache.org/solr/[Apache Solr] is a search engine. Spring Boot offers basic
http://lucene.apache.org/solr/[Apache Solr] is a search engine. Spring Boot offers basic
auto-configuration for the solr client library and abstractions on top of it provided by
auto-configuration for the solr client library and abstractions on top of it provided by
https://github.com/spring-projects/spring-data-solr[Spring Data Solr]. There is
https://github.com/spring-projects/spring-data-solr[Spring Data Solr]. There is
a `spring-boot-starter-data-solr`
``Starter POM'
' for collecting the dependencies in a
a `spring-boot-starter-data-solr`
'`Starter POM`
' for collecting the dependencies in a
convenient way.
convenient way.
...
@@ -1724,7 +1724,7 @@ http://www.elasticsearch.org/[Elastic Search] is an open source, distributed,
...
@@ -1724,7 +1724,7 @@ http://www.elasticsearch.org/[Elastic Search] is an open source, distributed,
real-time search and analytics engine. Spring Boot offers basic auto-configuration for
real-time search and analytics engine. Spring Boot offers basic auto-configuration for
the Elasticsearch and abstractions on top of it provided by
the Elasticsearch and abstractions on top of it provided by
https://github.com/spring-projects/spring-data-elasticsearch[Spring Data Elasticsearch].
https://github.com/spring-projects/spring-data-elasticsearch[Spring Data Elasticsearch].
There is a `spring-boot-starter-data-elasticsearch`
``Starter POM'
' for collecting the
There is a `spring-boot-starter-data-elasticsearch`
'`Starter POM`
' for collecting the
dependencies in a convenient way.
dependencies in a convenient way.
...
@@ -1735,7 +1735,7 @@ You can inject an auto-configured `ElasticsearchTemplate` or Elasticsearch `Clie
...
@@ -1735,7 +1735,7 @@ You can inject an auto-configured `ElasticsearchTemplate` or Elasticsearch `Clie
instance as you would any other Spring Bean. By default the instance will attempt to
instance as you would any other Spring Bean. By default the instance will attempt to
connect to a local in-memory server (a `NodeClient` in Elasticsearch terms), but you can
connect to a local in-memory server (a `NodeClient` in Elasticsearch terms), but you can
switch to a remote server (i.e. a `TransportClient`) by setting
switch to a remote server (i.e. a `TransportClient`) by setting
`spring.data.elasticsearch.clusterNodes` to a comma-separated
``host:port'
' list.
`spring.data.elasticsearch.clusterNodes` to a comma-separated
'`host:port`
' list.
[source,java,indent=0]
[source,java,indent=0]
----
----
...
@@ -1780,7 +1780,7 @@ http://docs.spring.io/spring-data/elasticsearch/docs/[reference documentation].
...
@@ -1780,7 +1780,7 @@ http://docs.spring.io/spring-data/elasticsearch/docs/[reference documentation].
The Spring Framework provides extensive support for integrating with messaging systems:
The Spring Framework provides extensive support for integrating with messaging systems:
from simplified use of the JMS API using `JmsTemplate` to a complete infrastructure to
from simplified use of the JMS API using `JmsTemplate` to a complete infrastructure to
receive messages asynchronously. Spring AMQP provides a similar feature set for the
receive messages asynchronously. Spring AMQP provides a similar feature set for the
``Advanced Message Queuing Protocol'
' and Boot also provides auto-configuration options
'`Advanced Message Queuing Protocol`
' and Boot also provides auto-configuration options
for `RabbitTemplate` and RabbitMQ. There is also support for STOMP messaging natively
for `RabbitTemplate` and RabbitMQ. There is also support for STOMP messaging natively
in Spring Websocket and Spring Boot has support for that through starters and a small
in Spring Websocket and Spring Boot has support for that through starters and a small
amount of auto configuration.
amount of auto configuration.
...
@@ -1836,7 +1836,7 @@ See {sc-spring-boot-autoconfigure}/jms/hornetq/HornetQProperties.{sc-ext}[`Horne
...
@@ -1836,7 +1836,7 @@ See {sc-spring-boot-autoconfigure}/jms/hornetq/HornetQProperties.{sc-ext}[`Horne
for more of the supported options.
for more of the supported options.
No JNDI lookup is involved at all and destinations are resolved against their names,
No JNDI lookup is involved at all and destinations are resolved against their names,
either using the
``name'
' attribute in the HornetQ configuration or the names provided
either using the
'`name`
' attribute in the HornetQ configuration or the names provided
through configuration.
through configuration.
...
@@ -1899,7 +1899,7 @@ own beans:
...
@@ -1899,7 +1899,7 @@ own beans:
Spring Integration provides abstractions over messaging and also other transports such as
Spring Integration provides abstractions over messaging and also other transports such as
HTTP, TCP etc. If Spring Integration is available on your classpath it will be initialized
HTTP, TCP etc. If Spring Integration is available on your classpath it will be initialized
through the `@EnableIntegration` annotation. Message processing statistics will be
through the `@EnableIntegration` annotation. Message processing statistics will be
published over JMX if `
`spring-integration-jmx''
is also on the classpath.
published over JMX if `
'spring-integration-jmx'`
is also on the classpath.
See the {sc-spring-boot-autoconfigure}/integration/IntegrationAutoConfiguration.{sc-ext}[`IntegrationAutoConfiguration`]
See the {sc-spring-boot-autoconfigure}/integration/IntegrationAutoConfiguration.{sc-ext}[`IntegrationAutoConfiguration`]
class for more details.
class for more details.
...
@@ -1909,7 +1909,7 @@ class for more details.
...
@@ -1909,7 +1909,7 @@ class for more details.
== Monitoring and management over JMX
== Monitoring and management over JMX
Java Management Extensions (JMX) provide a standard mechanism to monitor and manage
Java Management Extensions (JMX) provide a standard mechanism to monitor and manage
applications. By default Spring Boot will create an `MBeanServer` with bean id
applications. By default Spring Boot will create an `MBeanServer` with bean id
``mbeanServer'
' and expose any of your beans that are annotated with Spring JMX
'`mbeanServer`
' and expose any of your beans that are annotated with Spring JMX
annotations (`@ManagedResource`, `@ManagedAttribute`, `@ManagedOperation`).
annotations (`@ManagedResource`, `@ManagedAttribute`, `@ManagedOperation`).
See the {sc-spring-boot-autoconfigure}/jmx/JmxAutoConfiguration.{sc-ext}[`JmxAutoConfiguration`]
See the {sc-spring-boot-autoconfigure}/jmx/JmxAutoConfiguration.{sc-ext}[`JmxAutoConfiguration`]
...
@@ -1929,7 +1929,7 @@ under the `org.springframework.boot.test` package.
...
@@ -1929,7 +1929,7 @@ under the `org.springframework.boot.test` package.
[[boot-features-test-scope-dependencies]]
[[boot-features-test-scope-dependencies]]
=== Test scope dependencies
=== Test scope dependencies
If you use the
If you use the
`spring-boot-starter-test`
``Starter POM'
' (in the `test` `scope`), you will find
`spring-boot-starter-test`
'`Starter POM`
' (in the `test` `scope`), you will find
the following provided libraries:
the following provided libraries:
* Spring Test -- integration test support for Spring applications.
* Spring Test -- integration test support for Spring applications.
...
@@ -1948,14 +1948,14 @@ One of the major advantages of dependency injection is that it should make your
...
@@ -1948,14 +1948,14 @@ One of the major advantages of dependency injection is that it should make your
easier to unit test. You can simply instantiate objects using the `new` operator without
easier to unit test. You can simply instantiate objects using the `new` operator without
even involving Spring. You can also use _mock objects_ instead of real dependencies.
even involving Spring. You can also use _mock objects_ instead of real dependencies.
Often you need to move beyond
``unit testing'' and start ``integration testing'
' (with
Often you need to move beyond
'`unit testing`' and start '`integration testing`
' (with
a Spring `ApplicationContext` actually involved in the process). It's useful to be able
a Spring `ApplicationContext` actually involved in the process). It's useful to be able
to perform integration testing without requiring deployment of your application or
to perform integration testing without requiring deployment of your application or
needing to connect to other infrastructure.
needing to connect to other infrastructure.
The Spring Framework includes a dedicated test module for just such integration testing.
The Spring Framework includes a dedicated test module for just such integration testing.
You can declare a dependency directly to `org.springframework:spring-test` or use the
You can declare a dependency directly to `org.springframework:spring-test` or use the
`spring-boot-starter-test`
``Starter POM'
' to pull it in transitively.
`spring-boot-starter-test`
'`Starter POM`
' to pull it in transitively.
If you have not used the `spring-test` module before you should start by reading the
If you have not used the `spring-test` module before you should start by reading the
{spring-reference}/#testing[relevant section] of the Spring Framework reference
{spring-reference}/#testing[relevant section] of the Spring Framework reference
...
@@ -2215,7 +2215,7 @@ if you provide web specific configuration, your class may need to be applied aft
...
@@ -2215,7 +2215,7 @@ if you provide web specific configuration, your class may need to be applied aft
=== Condition annotations
=== Condition annotations
You almost always want to include one or more `@Condition` annotations on your
You almost always want to include one or more `@Condition` annotations on your
auto-configuration class. The `@ConditionalOnMissingBean` is one common example that is
auto-configuration class. The `@ConditionalOnMissingBean` is one common example that is
used to allow developers to
``override'
' auto-configuration if they are not happy with
used to allow developers to
'`override`
' auto-configuration if they are not happy with
your defaults.
your defaults.
Spring Boot includes a number of `@Conditional` annotations that you can reuse in your own
Spring Boot includes a number of `@Conditional` annotations that you can reuse in your own
...
...
spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc
View file @
6a503d5c
[[
using
-
boot
]]
[[
using
-
boot
]]
=
Using
Spring
Boot
=
Using
Spring
Boot
...
@@ -198,7 +199,7 @@ running quickly and with a consistent, supported set of managed transitive depen
...
@@ -198,7 +199,7 @@ running quickly and with a consistent, supported set of managed transitive depen
.
What
's in a name
.
What
's in a name
****
****
All starters follow a similar naming pattern; `spring-boot-starter-*`, where `*` is
All starters follow a similar naming pattern; `spring-boot-starter-
\
*`, where `*` is
a particular type of application. This naming structure is intended to help when you need
a particular type of application. This naming structure is intended to help when you need
to find a starter. The Maven integration in many IDEs allow you to search dependencies by
to find a starter. The Maven integration in many IDEs allow you to search dependencies by
name. For example, with the appropriate Eclipse or STS plugin installed, you can simply
name. For example, with the appropriate Eclipse or STS plugin installed, you can simply
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment