@@ -91,7 +91,8 @@ For example, `server.port` and `server.address` might be specified in `applicati
...
@@ -91,7 +91,8 @@ For example, `server.port` and `server.address` might be specified in `applicati
The "`groups`" are higher level items that do not themselves specify a value but instead provide a contextual grouping for properties.
The "`groups`" are higher level items that do not themselves specify a value but instead provide a contextual grouping for properties.
For example, the `server.port` and `server.address` properties are part of the `server` group.
For example, the `server.port` and `server.address` properties are part of the `server` group.
NOTE: It is not required that every "`property`" has a "`group`". Some properties might exist in their own right.
NOTE: It is not required that every "`property`" has a "`group`".
Some properties might exist in their own right.
Finally, "`hints`" are additional information used to assist the user in configuring a given property.
Finally, "`hints`" are additional information used to assist the user in configuring a given property.
For example, when a developer is configuring the `spring.jpa.hibernate.ddl-auto` property, a tool can use the hints to offer some auto-completion help for the `none`, `validate`, `update`, `create`, and `create-drop` values.
For example, when a developer is configuring the `spring.jpa.hibernate.ddl-auto` property, a tool can use the hints to offer some auto-completion help for the `none`, `validate`, `update`, `create`, and `create-drop` values.
...
@@ -108,7 +109,8 @@ The JSON object contained in the `groups` array can contain the attributes shown
...
@@ -108,7 +109,8 @@ The JSON object contained in the `groups` array can contain the attributes shown
| `name`
| `name`
| String
| String
| The full name of the group. This attribute is mandatory.
| The full name of the group.
This attribute is mandatory.
| `type`
| `type`
| String
| String
...
@@ -318,7 +320,8 @@ The JSON object contained in the `providers` attribute of each `hint` element ca
...
@@ -318,7 +320,8 @@ The JSON object contained in the `providers` attribute of each `hint` element ca
[[configuration-metadata-repeated-items]]
[[configuration-metadata-repeated-items]]
==== Repeated Metadata Items
==== Repeated Metadata Items
Objects with the same "`property`" and "`group`" name can appear multiple times within a metadata file. For example, you could bind two separate classes to the same prefix, with each having potentially overlapping property names.
Objects with the same "`property`" and "`group`" name can appear multiple times within a metadata file.
For example, you could bind two separate classes to the same prefix, with each having potentially overlapping property names.
While the same names appearing in the metadata multiple times should not be common, consumers of metadata should take care to ensure that they support it.
While the same names appearing in the metadata multiple times should not be common, consumers of metadata should take care to ensure that they support it.
@@ -400,7 +400,8 @@ A fully executable jar can be executed like any other executable binary or it ca
...
@@ -400,7 +400,8 @@ A fully executable jar can be executed like any other executable binary or it ca
This makes it very easy to install and manage Spring Boot applications in common production environments.
This makes it very easy to install and manage Spring Boot applications in common production environments.
CAUTION: Fully executable jars work by embedding an extra script at the front of the file.
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. For example, `jar -xf` may silently fail to extract a jar or war that has been made fully executable.
Currently, some tools do not accept this format, so you may not always be able to use this technique.
For example, `jar -xf` may silently fail to extract a jar or war that has been made fully executable.
It is recommended that you make your jar or war fully executable only if you intend to execute it directly, rather than running it with `java -jar`or deploying it to a servlet container.
It is recommended that you make your jar or war fully executable only if you intend to execute it directly, rather than running it with `java -jar`or deploying it to a servlet container.
To create a '`fully executable`' jar with Maven, use the following plugin configuration:
To create a '`fully executable`' jar with Maven, use the following plugin configuration:
...
@@ -520,7 +521,8 @@ One way to protect against this is to make it immutable by using `chattr`, as sh
...
@@ -520,7 +521,8 @@ One way to protect against this is to make it immutable by using `chattr`, as sh
This will prevent any user, including root, from modifying the jar.
This will prevent any user, including root, from modifying the jar.
If root is used to control the application's service and you <<deployment-script-customization-conf-file, use a `.conf` file>> to customize its startup, the `.conf` file is read and evaluated by the root user.
If root is used to control the application's service and you <<deployment-script-customization-conf-file, use a `.conf` file>> to customize its startup, the `.conf` file is read and evaluated by the root user.
It should be secured accordingly. Use `chmod` so that the file can only be read by the owner and use `chown` to make root the owner, as shown in the following example:
It should be secured accordingly.
Use `chmod` so that the file can only be read by the owner and use `chown` to make root the owner, as shown in the following example:
[indent=0,subs="verbatim,quotes,attributes"]
[indent=0,subs="verbatim,quotes,attributes"]
----
----
...
@@ -650,17 +652,20 @@ The following property substitutions are supported with the default script:
...
@@ -650,17 +652,20 @@ The following property substitutions are supported with the default script:
|
|
| `logFolder`
| `logFolder`
| Default value for `LOG_FOLDER`. Only valid for an `init.d` service
| Default value for `LOG_FOLDER`.
Only valid for an `init.d` service
|
|
|
|
| `logFilename`
| `logFilename`
| Default value for `LOG_FILENAME`. Only valid for an `init.d` service
| Default value for `LOG_FILENAME`.
Only valid for an `init.d` service
|
|
|
|
| `pidFolder`
| `pidFolder`
| Default value for `PID_FOLDER`. Only valid for an `init.d` service
| Default value for `PID_FOLDER`.
Only valid for an `init.d` service
|
|
|
|
...
@@ -676,7 +681,8 @@ The following property substitutions are supported with the default script:
...
@@ -676,7 +681,8 @@ The following property substitutions are supported with the default script:
| `true`
| `true`
| `stopWaitTime`
| `stopWaitTime`
| Default value for `STOP_WAIT_TIME` in seconds. Only valid for an `init.d` service
| Default value for `STOP_WAIT_TIME` in seconds.
Only valid for an `init.d` service
| 60
| 60
| 60
| 60
|===
|===
...
@@ -738,7 +744,8 @@ The following environment properties are supported with the default script:
...
@@ -738,7 +744,8 @@ The following environment properties are supported with the default script:
| The time in seconds to wait when stopping the application before forcing a shutdown (`60` by default).
| The time in seconds to wait when stopping the application before forcing a shutdown (`60` by default).
|===
|===
NOTE: The `PID_FOLDER`, `LOG_FOLDER`, and `LOG_FILENAME` variables are only valid for an `init.d` service. For `systemd`, the equivalent customizations are made by using the '`service`' script.
NOTE: The `PID_FOLDER`, `LOG_FOLDER`, and `LOG_FILENAME` variables are only valid for an `init.d` service.
For `systemd`, the equivalent customizations are made by using the '`service`' script.
See the https://www.freedesktop.org/software/systemd/man/systemd.service.html[service unit configuration man page] for more details.
See the https://www.freedesktop.org/software/systemd/man/systemd.service.html[service unit configuration man page] for more details.
The `${..}` style conflicts with Spring's own property placeholder mechanism.
To use Spring property placeholders together with automatic expansion, escape the Spring property placeholders as follows: `\${..}`.
To use Spring property placeholders together with automatic expansion, escape the Spring property placeholders as follows: `\${..}`.
...
@@ -644,7 +645,8 @@ Generally, you should first consider using one of the many available configurati
...
@@ -644,7 +645,8 @@ Generally, you should first consider using one of the many available configurati
The `server.{asterisk}` namespace is quite useful here, and it includes namespaces like `server.tomcat.{asterisk}`, `server.jetty.{asterisk}` and others, for server-specific features.
The `server.{asterisk}` namespace is quite useful here, and it includes namespaces like `server.tomcat.{asterisk}`, `server.jetty.{asterisk}` and others, for server-specific features.
See the list of <<common-application-properties>>.
See the list of <<common-application-properties>>.
The previous sections covered already many common use cases, such as compression, SSL or HTTP/2. However, if a configuration key doesn't exist for your use case, you should then look at {spring-boot-module-api}/web/server/WebServerFactoryCustomizer.html[`WebServerFactoryCustomizer`].
The previous sections covered already many common use cases, such as compression, SSL or HTTP/2.
However, if a configuration key doesn't exist for your use case, you should then look at {spring-boot-module-api}/web/server/WebServerFactoryCustomizer.html[`WebServerFactoryCustomizer`].
You can declare such a component and get access to the server factory relevant to your choice: you should select the variant for the chosen Server (Tomcat, Jetty, Reactor Netty, Undertow) and the chosen web stack (Servlet or Reactive).
You can declare such a component and get access to the server factory relevant to your choice: you should select the variant for the chosen Server (Tomcat, Jetty, Reactor Netty, Undertow) and the chosen web stack (Servlet or Reactive).
The example below is for Tomcat with the `spring-boot-starter-web` (Servlet stack):
The example below is for Tomcat with the `spring-boot-starter-web` (Servlet stack):
...
@@ -1167,7 +1169,8 @@ If you add your own, you have to be aware of the order and in which position you
...
@@ -1167,7 +1169,8 @@ If you add your own, you have to be aware of the order and in which position you
You can override `FreeMarkerViewResolver` by providing a bean of the same name.
You can override `FreeMarkerViewResolver` by providing a bean of the same name.
* If you use Groovy templates (actually, if `groovy-templates` is on your classpath), you also have a `GroovyMarkupViewResolver` named '`groovyMarkupViewResolver`'.
* If you use Groovy templates (actually, if `groovy-templates` is on your classpath), you also have a `GroovyMarkupViewResolver` named '`groovyMarkupViewResolver`'.
It looks for resources in a loader path by surrounding the view name with a prefix and suffix (externalized to `spring.groovy.template.prefix` and `spring.groovy.template.suffix`).
It looks for resources in a loader path by surrounding the view name with a prefix and suffix (externalized to `spring.groovy.template.prefix` and `spring.groovy.template.suffix`).
The prefix and suffix have default values of '`classpath:/templates/`' and '`.tpl`', respectively. You can override `GroovyMarkupViewResolver` by providing a bean of the same name.
The prefix and suffix have default values of '`classpath:/templates/`' and '`.tpl`', respectively.
You can override `GroovyMarkupViewResolver` by providing a bean of the same name.
For more detail, see the following sections:
For more detail, see the following sections:
...
@@ -1503,7 +1506,8 @@ The following example shows how to define a JDBC data source by setting properti
...
@@ -1503,7 +1506,8 @@ The following example shows how to define a JDBC data source by setting properti
However, there is a catch.
However, there is a catch.
Because the actual type of the connection pool is not exposed, no keys are generated in the metadata for your custom `DataSource` and no completion is available in your IDE (because the `DataSource` interface exposes no properties).
Because the actual type of the connection pool is not exposed, no keys are generated in the metadata for your custom `DataSource` and no completion is available in your IDE (because the `DataSource` interface exposes no properties).
Also, if you happen to have Hikari on the classpath, this basic setup does not work, because Hikari has no `url` property (but does have a `jdbcUrl` property). In that case, you must rewrite your configuration as follows:
Also, if you happen to have Hikari on the classpath, this basic setup does not work, because Hikari has no `url` property (but does have a `jdbcUrl` property).
In that case, you must rewrite your configuration as follows:
[source,properties,indent=0]
[source,properties,indent=0]
----
----
...
@@ -1559,7 +1563,8 @@ See "`<<spring-boot-features.adoc#boot-features-configure-datasource>>`" in the
...
@@ -1559,7 +1563,8 @@ See "`<<spring-boot-features.adoc#boot-features-configure-datasource>>`" in the
If you need to configure multiple data sources, you can apply the same tricks that are described in the previous section.
If you need to configure multiple data sources, you can apply the same tricks that are described in the previous section.
You must, however, mark one of the `DataSource` instances as `@Primary`, because various auto-configurations down the road expect to be able to get one by type.
You must, however, mark one of the `DataSource` instances as `@Primary`, because various auto-configurations down the road expect to be able to get one by type.
If you create your own `DataSource`, the auto-configuration backs off. In the following example, we provide the _exact_ same feature set as the auto-configuration provides on the primary data source:
If you create your own `DataSource`, the auto-configuration backs off.
In the following example, we provide the _exact_ same feature set as the auto-configuration provides on the primary data source:
TIP: `firstDataSourceProperties` has to be flagged as `@Primary` so that the database initializer feature uses your copy (if you use the initializer).
TIP: `firstDataSourceProperties` has to be flagged as `@Primary` so that the database initializer feature uses your copy (if you use the initializer).
Both data sources are also bound for advanced customizations. For instance, you could configure them as follows:
Both data sources are also bound for advanced customizations.
For instance, you could configure them as follows:
[source,properties,indent=0]
[source,properties,indent=0]
----
----
...
@@ -1704,7 +1710,8 @@ See {spring-boot-autoconfigure-module-code}/orm/jpa/HibernateJpaAutoConfiguratio
...
@@ -1704,7 +1710,8 @@ 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.
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.
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.
If you're using JCache, this is pretty easy.
First, make sure that `org.hibernate:hibernate-jcache` is available on the classpath.
Then, add a `HibernatePropertiesCustomizer` bean as shown in the following example:
Then, add a `HibernatePropertiesCustomizer` bean as shown in the following example:
[source,java,indent=0]
[source,java,indent=0]
...
@@ -1884,7 +1891,8 @@ This is controlled through two external properties:
...
@@ -1884,7 +1891,8 @@ This is controlled through two external properties:
You can set `spring.jpa.hibernate.ddl-auto` explicitly and the standard Hibernate property values are `none`, `validate`, `update`, `create`, and `create-drop`.
You can set `spring.jpa.hibernate.ddl-auto` explicitly and the standard Hibernate property values are `none`, `validate`, `update`, `create`, and `create-drop`.
Spring Boot chooses a default value for you based on whether it thinks your database is embedded.
Spring Boot chooses a default value for you based on whether it thinks your database is embedded.
It defaults to `create-drop` if no schema manager has been detected or `none` in all other cases.
It defaults to `create-drop` if no schema manager has been detected or `none` in all other cases.
An embedded database is detected by looking at the `Connection` type. `hsqldb`, `h2`, and `derby` are embedded, and others are not.
An embedded database is detected by looking at the `Connection` type.
`hsqldb`, `h2`, and `derby` are embedded, and others are not.
Be careful when switching from in-memory to a '`real`' database that you do not make assumptions about the existence of the tables and data in the new platform.
Be careful when switching from in-memory to a '`real`' database that you do not make assumptions about the existence of 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.
You either have to set `ddl-auto` explicitly or use one of the other mechanisms to initialize the database.
...
@@ -1973,7 +1981,8 @@ Assume the following:
...
@@ -1973,7 +1981,8 @@ Assume the following:
Rather than using `db/migration`, the preceding configuration sets the folder to use according to the type of the database (such as `db/migration/mysql` for MySQL).
Rather than using `db/migration`, the preceding configuration sets the folder to use according to the type of the database (such as `db/migration/mysql` for MySQL).
The list of supported databases is available in {spring-boot-module-code}/jdbc/DatabaseDriver.java[`DatabaseDriver`].
The list of supported databases is available in {spring-boot-module-code}/jdbc/DatabaseDriver.java[`DatabaseDriver`].
Migrations can also be written in Java. Flyway will be auto-configured with any beans that implement `JavaMigration`.
Migrations can also be written in Java.
Flyway will be auto-configured with any beans that implement `JavaMigration`.
{spring-boot-autoconfigure-module-code}/flyway/FlywayProperties.java[`FlywayProperties`] provides most of Flyway's settings and a small set of additional properties that can be used to disable the migrations or switch off the location checking.
{spring-boot-autoconfigure-module-code}/flyway/FlywayProperties.java[`FlywayProperties`] provides most of Flyway's settings and a small set of additional properties that can be used to disable the migrations or switch off the location checking.
If you need more control over the configuration, consider registering a `FlywayConfigurationCustomizer` bean.
If you need more control over the configuration, consider registering a `FlywayConfigurationCustomizer` bean.
...
@@ -2096,7 +2105,8 @@ See {spring-boot-autoconfigure-module-code}/batch/BatchAutoConfiguration.java[Ba
...
@@ -2096,7 +2105,8 @@ See {spring-boot-autoconfigure-module-code}/batch/BatchAutoConfiguration.java[Ba
[[howto-actuator]]
[[howto-actuator]]
== Actuator
== Actuator
Spring Boot includes the Spring Boot Actuator. This section answers questions that often arise from its use.
Spring Boot includes the Spring Boot Actuator.
This section answers questions that often arise from its use.
...
@@ -2175,7 +2185,8 @@ You can switch on the valve by adding some entries to `application.properties`,
...
@@ -2175,7 +2185,8 @@ You can switch on the valve by adding some entries to `application.properties`,
server.tomcat.protocol-header=x-forwarded-proto
server.tomcat.protocol-header=x-forwarded-proto
----
----
(The presence of either of those properties switches on the valve. Alternatively, you can add the `RemoteIpValve` by adding a `TomcatServletWebServerFactory` bean.)
(The presence of either of those properties switches on the valve.
Alternatively, you can add the `RemoteIpValve` by adding a `TomcatServletWebServerFactory` bean.)
To configure Spring Security to require a secure channel for all (or some) requests, consider adding your own `WebSecurityConfigurerAdapter` that adds the following `HttpSecurity` configuration:
To configure Spring Security to require a secure channel for all (or some) requests, consider adding your own `WebSecurityConfigurerAdapter` that adds the following `HttpSecurity` configuration:
...
@@ -2197,7 +2208,8 @@ To configure Spring Security to require a secure channel for all (or some) reque
...
@@ -2197,7 +2208,8 @@ To configure Spring Security to require a secure channel for all (or some) reque
[[howto-hotswapping]]
[[howto-hotswapping]]
== Hot Swapping
== Hot Swapping
Spring Boot supports hot swapping. This section answers questions about how it works.
Spring Boot supports hot swapping.
This section answers questions about how it works.
...
@@ -2749,7 +2761,8 @@ See the <<howto-build-an-application-context-hierarchy, entry on building a hier
...
@@ -2749,7 +2761,8 @@ See the <<howto-build-an-application-context-hierarchy, entry on building a hier
An existing parent context that contains web-specific features usually needs to be broken up so that all the `ServletContextAware` components are in the child context.
An existing parent context that contains web-specific features usually needs to be broken up so that all the `ServletContextAware` components are in the child context.
Applications that are not already Spring applications might be convertible to Spring Boot applications, and the previously mentioned guidance may help.
Applications that are not already Spring applications might be convertible to Spring Boot applications, and the previously mentioned guidance may help.
However, you may yet encounter problems. In that case, we suggest https://stackoverflow.com/questions/tagged/spring-boot[asking questions on Stack Overflow with a tag of `spring-boot`].
However, you may yet encounter problems.
In that case, we suggest https://stackoverflow.com/questions/tagged/spring-boot[asking questions on Stack Overflow with a tag of `spring-boot`].
`*` can be used to select all endpoints. For example, to expose everything over HTTP except the `env` and `beans` endpoints, use the following properties:
`*` can be used to select all endpoints.
For example, to expose everything over HTTP except the `env` and `beans` endpoints, use the following properties:
[source,properties,indent=0]
[source,properties,indent=0]
----
----
...
@@ -426,7 +427,8 @@ NOTE: When making an authenticated HTTP request, the `Principal` is considered a
...
@@ -426,7 +427,8 @@ NOTE: When making an authenticated HTTP request, the `Principal` is considered a
[[production-ready-endpoints-hypermedia]]
[[production-ready-endpoints-hypermedia]]
=== Hypermedia for Actuator Web Endpoints
=== Hypermedia for Actuator Web Endpoints
A "`discovery page`" is added with links to all the endpoints. The "`discovery page`" is available on `/actuator` by default.
A "`discovery page`" is added with links to all the endpoints.
The "`discovery page`" is available on `/actuator` by default.
When a custom management context path is configured, the "`discovery page`" automatically moves from `/actuator` to the root of the management context.
When a custom management context path is configured, the "`discovery page`" automatically moves from `/actuator` to the root of the management context.
For example, if the management context path is `/management`, then the discovery page is available from `/management`.
For example, if the management context path is `/management`, then the discovery page is available from `/management`.
...
@@ -638,7 +640,8 @@ The information exposed by the `health` endpoint depends on the `management.endp
...
@@ -638,7 +640,8 @@ The information exposed by the `health` endpoint depends on the `management.endp
| Details are shown to all users.
| Details are shown to all users.
|===
|===
The default value is `never`. A user is considered to be authorized when they are in one or more of the endpoint's roles.
The default value is `never`.
A user is considered to be authorized when they are in one or more of the endpoint's roles.
If the endpoint has no configured roles (the default) all authenticated users are considered to be authorized.
If the endpoint has no configured roles (the default) all authenticated users are considered to be authorized.
The roles can be configured using the `management.endpoint.health.roles` property.
The roles can be configured using the `management.endpoint.health.roles` property.
...
@@ -759,7 +762,8 @@ To configure the severity order, add the following property to your application
...
@@ -759,7 +762,8 @@ To configure the severity order, add the following property to your application
----
----
The HTTP status code in the response reflects the overall health status (for example, `UP` maps to 200, while `OUT_OF_SERVICE` and `DOWN` map to 503).
The HTTP status code in the response reflects the overall health status (for example, `UP` maps to 200, while `OUT_OF_SERVICE` and `DOWN` map to 503).
You might also want to register custom status mappings if you access the health endpoint over HTTP. For example, the following property maps `FATAL` to 503 (service unavailable):
You might also want to register custom status mappings if you access the health endpoint over HTTP.
For example, the following property maps `FATAL` to 503 (service unavailable):
[source,properties,indent=0]
[source,properties,indent=0]
----
----
...
@@ -1701,7 +1705,8 @@ By default, Spring MVC-related metrics are tagged with the following information
...
@@ -1701,7 +1705,8 @@ By default, Spring MVC-related metrics are tagged with the following information
| Request's method (for example, `GET` or `POST`)
| Request's method (for example, `GET` or `POST`)
| `outcome`
| `outcome`
| Request's outcome based on the status code of the response. 1xx is `INFORMATIONAL`, 2xx is `SUCCESS`, 3xx is `REDIRECTION`, 4xx `CLIENT_ERROR`, and 5xx is `SERVER_ERROR`
| Request's outcome based on the status code of the response.
1xx is `INFORMATIONAL`, 2xx is `SUCCESS`, 3xx is `REDIRECTION`, 4xx `CLIENT_ERROR`, and 5xx is `SERVER_ERROR`
| `status`
| `status`
| Response's HTTP status code (for example, `200` or `500`)
| Response's HTTP status code (for example, `200` or `500`)
...
@@ -1733,7 +1738,8 @@ By default, WebFlux-related metrics are tagged with the following information:
...
@@ -1733,7 +1738,8 @@ By default, WebFlux-related metrics are tagged with the following information:
| Request's method (for example, `GET` or `POST`)
| Request's method (for example, `GET` or `POST`)
| `outcome`
| `outcome`
| Request's outcome based on the status code of the response. 1xx is `INFORMATIONAL`, 2xx is `SUCCESS`, 3xx is `REDIRECTION`, 4xx `CLIENT_ERROR`, and 5xx is `SERVER_ERROR`
| Request's outcome based on the status code of the response.
1xx is `INFORMATIONAL`, 2xx is `SUCCESS`, 3xx is `REDIRECTION`, 4xx `CLIENT_ERROR`, and 5xx is `SERVER_ERROR`
| `status`
| `status`
| Response's HTTP status code (for example, `200` or `500`)
| Response's HTTP status code (for example, `200` or `500`)
...
@@ -1785,7 +1791,8 @@ By default, Jersey server metrics are tagged with the following information:
...
@@ -1785,7 +1791,8 @@ By default, Jersey server metrics are tagged with the following information:
| Request's method (for example, `GET` or `POST`)
| Request's method (for example, `GET` or `POST`)
| `outcome`
| `outcome`
| Request's outcome based on the status code of the response. 1xx is `INFORMATIONAL`, 2xx is `SUCCESS`, 3xx is `REDIRECTION`, 4xx `CLIENT_ERROR`, and 5xx is `SERVER_ERROR`
| Request's outcome based on the status code of the response.
1xx is `INFORMATIONAL`, 2xx is `SUCCESS`, 3xx is `REDIRECTION`, 4xx `CLIENT_ERROR`, and 5xx is `SERVER_ERROR`
| `status`
| `status`
| Response's HTTP status code (for example, `200` or `500`)
| Response's HTTP status code (for example, `200` or `500`)
...
@@ -1823,7 +1830,8 @@ By default, metrics generated by an instrumented client are tagged with the foll
...
@@ -1823,7 +1830,8 @@ By default, metrics generated by an instrumented client are tagged with the foll
| Request's method (for example, `GET` or `POST`)
| Request's method (for example, `GET` or `POST`)
| `outcome`
| `outcome`
| Request's outcome based on the status code of the response. 1xx is `INFORMATIONAL`, 2xx is `SUCCESS`, 3xx is `REDIRECTION`, 4xx `CLIENT_ERROR`, and 5xx is `SERVER_ERROR`, `UNKNOWN` otherwise
| Request's outcome based on the status code of the response.
1xx is `INFORMATIONAL`, 2xx is `SUCCESS`, 3xx is `REDIRECTION`, 4xx `CLIENT_ERROR`, and 5xx is `SERVER_ERROR`, `UNKNOWN` otherwise
| `status`
| `status`
| Response's HTTP status code if available (for example, `200` or `500`), or `IO_ERROR` in case of I/O issues, `CLIENT_ERROR` otherwise
| Response's HTTP status code if available (for example, `200` or `500`), or `IO_ERROR` in case of I/O issues, `CLIENT_ERROR` otherwise
...
@@ -2120,7 +2128,8 @@ If the server's context-path has been configured to anything other than `/`, the
...
@@ -2120,7 +2128,8 @@ If the server's context-path has been configured to anything other than `/`, the
For example, if `server.servlet.context-path=/app`, Cloud Foundry endpoints will be available at `/app/cloudfoundryapplication/*`.
For example, if `server.servlet.context-path=/app`, Cloud Foundry endpoints will be available at `/app/cloudfoundryapplication/*`.
If you expect the Cloud Foundry endpoints to always be available at `/cloudfoundryapplication/*`, regardless of the server's context-path, you will need to explicitly configure that in your application.
If you expect the Cloud Foundry endpoints to always be available at `/cloudfoundryapplication/*`, regardless of the server's context-path, you will need to explicitly configure that in your application.
The configuration will differ depending on the web server in use. For Tomcat, the following configuration can be added:
The configuration will differ depending on the web server in use.
For Tomcat, the following configuration can be added:
@@ -360,7 +360,8 @@ The command takes one or more sets of artifact coordinates in the format `group:
...
@@ -360,7 +360,8 @@ The command takes one or more sets of artifact coordinates in the format `group:
In addition to installing the artifacts identified by the coordinates you supply, all of the artifacts' dependencies are also installed.
In addition to installing the artifacts identified by the coordinates you supply, all of the artifacts' dependencies are also installed.
To uninstall a dependency, use the `uninstall` command. As with the `install` command, it takes one or more sets of artifact coordinates in the format of `group:artifact:version`, as shown in the following example:
To uninstall a dependency, use the `uninstall` command.
As with the `install` command, it takes one or more sets of artifact coordinates in the format of `group:artifact:version`, as shown in the following example:
@@ -30,7 +30,8 @@ NOTE: You can still specify a version and override Spring Boot's recommendations
...
@@ -30,7 +30,8 @@ NOTE: You can still specify a version and override Spring Boot's recommendations
The curated list contains all the spring modules that you can use with Spring Boot as well as a refined list of third party libraries.
The curated list contains all the spring modules that you can use with Spring Boot as well as a refined list of third party libraries.
The list is available as a standard <<using-boot-maven-without-a-parent,Bills of Materials (`spring-boot-dependencies`)>> that can be used with both <<using-boot-maven-parent-pom,Maven>> and <<using-boot-gradle,Gradle>>.
The list is available as a standard <<using-boot-maven-without-a-parent,Bills of Materials (`spring-boot-dependencies`)>> that can be used with both <<using-boot-maven-parent-pom,Maven>> and <<using-boot-gradle,Gradle>>.
WARNING: Each release of Spring Boot is associated with a base version of the Spring Framework. We **highly** recommend that you not specify its version.
WARNING: Each release of Spring Boot is associated with a base version of the Spring Framework.
We **highly** recommend that you not specify its version.
...
@@ -275,7 +276,8 @@ TIP: For a list of additional community contributed starters, see the {spring-bo
...
@@ -275,7 +276,8 @@ TIP: For a list of additional community contributed starters, see the {spring-bo
[[using-boot-structuring-your-code]]
[[using-boot-structuring-your-code]]
== Structuring Your Code
== Structuring Your Code
Spring Boot does not require any specific code layout to work. However, there are some best practices that help.
Spring Boot does not require any specific code layout to work.
However, there are some best practices that help.
...
@@ -534,9 +536,11 @@ In this example, `Application` is just like any other Spring Boot application ex
...
@@ -534,9 +536,11 @@ In this example, `Application` is just like any other Spring Boot application ex
[[using-boot-running-your-application]]
[[using-boot-running-your-application]]
== Running Your Application
== Running Your Application
One of the biggest advantages of packaging your application as a jar and using an embedded HTTP server is that you can run your application as you would any other.
One of the biggest advantages of packaging your application as a jar and using an embedded HTTP server is that you can run your application as you would any other.
Debugging Spring Boot applications is also easy. You do not need any special IDE plugins or extensions.
Debugging Spring Boot applications is also easy.
You do not need any special IDE plugins or extensions.
NOTE: This section only covers jar based packaging. If you choose to package your application as a war file, you should refer to your server and IDE documentation.
NOTE: This section only covers jar based packaging.
If you choose to package your application as a war file, you should refer to your server and IDE documentation.
...
@@ -548,10 +552,12 @@ Import steps vary depending on your IDE and build system.
...
@@ -548,10 +552,12 @@ Import steps vary depending on your IDE and build system.
Most IDEs can import Maven projects directly.
Most IDEs can import Maven projects directly.
For example, Eclipse users can select `Import...` -> `Existing Maven Projects` from the `File` menu.
For example, Eclipse users can select `Import...` -> `Existing Maven Projects` from the `File` menu.
If you cannot directly import your project into your IDE, you may be able to generate IDE metadata by using a build plugin. Maven includes plugins for https://maven.apache.org/plugins/maven-eclipse-plugin/[Eclipse] and https://maven.apache.org/plugins/maven-idea-plugin/[IDEA].
If you cannot directly import your project into your IDE, you may be able to generate IDE metadata by using a build plugin.
Maven includes plugins for https://maven.apache.org/plugins/maven-eclipse-plugin/[Eclipse] and https://maven.apache.org/plugins/maven-idea-plugin/[IDEA].
Gradle offers plugins for {gradle-docs}/userguide.html[various IDEs].
Gradle offers plugins for {gradle-docs}/userguide.html[various IDEs].
TIP: If you accidentally run a web application twice, you see a "`Port already in use`" error. STS users can use the `Relaunch` button rather than the `Run` button to ensure that any existing instance is closed.
TIP: If you accidentally run a web application twice, you see a "`Port already in use`" error.
STS users can use the `Relaunch` button rather than the `Run` button to ensure that any existing instance is closed.
...
@@ -663,7 +669,8 @@ If that does not apply to you (i.e. if you run your application from a container
...
@@ -663,7 +669,8 @@ If that does not apply to you (i.e. if you run your application from a container
TIP: Flagging the dependency as optional in Maven or using a custom `developmentOnly` configuration in Gradle (as shown above) is a best practice that prevents devtools from being transitively applied to other modules that use your project.
TIP: Flagging the dependency as optional in Maven or using a custom `developmentOnly` configuration in Gradle (as shown above) is a best practice that prevents devtools from being transitively applied to other modules that use your project.
TIP: Repackaged archives do not contain devtools by default. If you want to use a <<using-boot-devtools-remote,certain remote devtools feature>>, you need to disable the `excludeDevtools` build property to include it.
TIP: Repackaged archives do not contain devtools by default.
If you want to use a <<using-boot-devtools-remote,certain remote devtools feature>>, you need to disable the `excludeDevtools` build property to include it.
The property is supported with both the Maven and Gradle plugins.
The property is supported with both the Maven and Gradle plugins.
...
@@ -710,7 +717,8 @@ NOTE: As long as forking is enabled, you can also start your application by usin
...
@@ -710,7 +717,8 @@ NOTE: As long as forking is enabled, you can also start your application by usin
By default, the Gradle and Maven plugins fork the application process.
By default, the Gradle and Maven plugins fork the application process.
TIP: Automatic restart works very well when used with LiveReload.
TIP: Automatic restart works very well when used with LiveReload.
<<using-boot-devtools-livereload,See the LiveReload section>> for details. If you use JRebel, automatic restarts are disabled in favor of dynamic class reloading.
<<using-boot-devtools-livereload,See the LiveReload section>> for details.
If you use JRebel, automatic restarts are disabled in favor of dynamic class reloading.
Other devtools features (such as LiveReload and property overrides) can still be used.
Other devtools features (such as LiveReload and property overrides) can still be used.
NOTE: DevTools relies on the application context's shutdown hook to close it during a restart.
NOTE: DevTools relies on the application context's shutdown hook to close it during a restart.
...
@@ -850,7 +858,8 @@ The value of the property is a regex pattern that is applied to the classpath, a
...
@@ -850,7 +858,8 @@ The value of the property is a regex pattern that is applied to the classpath, a
NOTE: All property keys must be unique. As long as a property starts with `restart.include.` or `restart.exclude.` it is considered.
NOTE: All property keys must be unique.
As long as a property starts with `restart.include.` or `restart.exclude.` it is considered.
TIP: All `META-INF/spring-devtools.properties` from the classpath are loaded.
TIP: All `META-INF/spring-devtools.properties` from the classpath are loaded.
You can package files inside your project, or in the libraries that the project consumes.
You can package files inside your project, or in the libraries that the project consumes.
...
@@ -874,7 +883,8 @@ LiveReload browser extensions are freely available for Chrome, Firefox and Safar
...
@@ -874,7 +883,8 @@ LiveReload browser extensions are freely available for Chrome, Firefox and Safar
If you do not want to start the LiveReload server when your application runs, you can set the `spring.devtools.livereload.enabled` property to `false`.
If you do not want to start the LiveReload server when your application runs, you can set the `spring.devtools.livereload.enabled` property to `false`.
NOTE: You can only run one LiveReload server at a time. Before starting your application, ensure that no other LiveReload servers are running.
NOTE: You can only run one LiveReload server at a time.
Before starting your application, ensure that no other LiveReload servers are running.
If you start multiple applications from your IDE, only the first has LiveReload support.
If you start multiple applications from your IDE, only the first has LiveReload support.