commit
f20b100a25
|
|
@ -206,7 +206,7 @@ properties (System properties, environment variables, manifest entries, or
|
||||||
|Key |Purpose
|
|Key |Purpose
|
||||||
|
|
||||||
|`loader.path`
|
|`loader.path`
|
||||||
|Comma-separated Classpath, such as `lib,${HOME}/app/lib`. Earlier entries take
|
|Comma-separated Classpath, such as `lib,$\{HOME}/app/lib`. Earlier entries take
|
||||||
precedence, like a regular `-classpath` on the `javac` command line.
|
precedence, like a regular `-classpath` on the `javac` command line.
|
||||||
|
|
||||||
|`loader.home`
|
|`loader.home`
|
||||||
|
|
|
||||||
|
|
@ -231,7 +231,7 @@ You also need to include the following element inside `<plugins/>`:
|
||||||
----
|
----
|
||||||
|
|
||||||
NOTE: The `useDefaultDelimiters` property is important if you use standard Spring
|
NOTE: The `useDefaultDelimiters` property is important if you use standard Spring
|
||||||
placeholders (such as `${placeholder}`) in your configuration. If that property is not
|
placeholders (such as `$\{placeholder}`) in your configuration. If that property is not
|
||||||
set to `false`, these may be expanded by the build.
|
set to `false`, these may be expanded by the build.
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -472,7 +472,7 @@ NOTE: The YAML documents are merged in the order in which they are encountered.
|
||||||
values override earlier values.
|
values override earlier values.
|
||||||
|
|
||||||
To do the same thing with properties files, you can use
|
To do the same thing with properties files, you can use
|
||||||
`application-${profile}.properties` to specify profile-specific values.
|
`application-$\{profile}.properties` to specify profile-specific values.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1567,11 +1567,11 @@ want to set levels, as shown in the following example:
|
||||||
If you look at `base.xml` in the spring-boot jar, you can see that it uses
|
If you look at `base.xml` in the spring-boot jar, you can see that it uses
|
||||||
some useful System properties that the `LoggingSystem` takes care of creating for you:
|
some useful System properties that the `LoggingSystem` takes care of creating for you:
|
||||||
|
|
||||||
* `${PID}`: The current process ID.
|
* `$\{PID}`: The current process ID.
|
||||||
* `${LOG_FILE}`: Whether `logging.file.name` was set in Boot's external configuration.
|
* `$\{LOG_FILE}`: Whether `logging.file.name` was set in Boot's external configuration.
|
||||||
* `${LOG_PATH}`: Whether `logging.file.path` (representing a directory for
|
* `$\{LOG_PATH}`: Whether `logging.file.path` (representing a directory for
|
||||||
log files to live in) was set in Boot's external configuration.
|
log files to live in) was set in Boot's external configuration.
|
||||||
* `${LOG_EXCEPTION_CONVERSION_WORD}`: Whether `logging.exception-conversion-word` was set
|
* `$\{LOG_EXCEPTION_CONVERSION_WORD}`: Whether `logging.exception-conversion-word` was set
|
||||||
in Boot's external configuration.
|
in Boot's external configuration.
|
||||||
|
|
||||||
Spring Boot also provides some nice ANSI color terminal output on a console (but not in
|
Spring Boot also provides some nice ANSI color terminal output on a console (but not in
|
||||||
|
|
@ -2240,7 +2240,7 @@ It is a Hibernate feature (and has nothing to do with Spring).
|
||||||
Spring Boot can automatically create the schema (DDL scripts) of your `DataSource` and
|
Spring Boot can automatically create the schema (DDL scripts) of your `DataSource` and
|
||||||
initialize it (DML scripts). It loads SQL from the standard root classpath locations:
|
initialize it (DML scripts). It loads SQL from the standard root classpath locations:
|
||||||
`schema.sql` and `data.sql`, respectively. In addition, Spring Boot processes the
|
`schema.sql` and `data.sql`, respectively. In addition, Spring Boot processes the
|
||||||
`schema-${platform}.sql` and `data-${platform}.sql` files (if present), where `platform`
|
`schema-$\{platform}.sql` and `data-$\{platform}.sql` files (if present), where `platform`
|
||||||
is the value of `spring.datasource.platform`. This allows you to switch to
|
is the value of `spring.datasource.platform`. This allows you to switch to
|
||||||
database-specific scripts if necessary. For example, you might choose to set it to the
|
database-specific scripts if necessary. For example, you might choose to set it to the
|
||||||
vendor name of the database (`hsqldb`, `h2`, `oracle`, `mysql`, `postgresql`, and so on).
|
vendor name of the database (`hsqldb`, `h2`, `oracle`, `mysql`, `postgresql`, and so on).
|
||||||
|
|
@ -2306,12 +2306,12 @@ scripts in both the default classpath location and the `/opt/migration` director
|
||||||
spring.flyway.locations=classpath:db/migration,filesystem:/opt/migration
|
spring.flyway.locations=classpath:db/migration,filesystem:/opt/migration
|
||||||
----
|
----
|
||||||
|
|
||||||
You can also add a special `{vendor}` placeholder to use vendor-specific scripts. Assume
|
You can also add a special `\{vendor}` placeholder to use vendor-specific scripts. Assume
|
||||||
the following:
|
the following:
|
||||||
|
|
||||||
[source,properties,indent=0]
|
[source,properties,indent=0]
|
||||||
----
|
----
|
||||||
spring.flyway.locations=classpath:db/migration/{vendor}
|
spring.flyway.locations=classpath:db/migration/\{vendor}
|
||||||
----
|
----
|
||||||
|
|
||||||
Rather than using `db/migration`, the preceding configuration sets the folder to use
|
Rather than using `db/migration`, the preceding configuration sets the folder to use
|
||||||
|
|
|
||||||
|
|
@ -1097,7 +1097,7 @@ management endpoint, as shown in the following example:
|
||||||
----
|
----
|
||||||
|
|
||||||
The preceding `application.properties` example changes the endpoint from
|
The preceding `application.properties` example changes the endpoint from
|
||||||
`/actuator/{id}` to `/manage/{id}` (for example, `/manage/info`).
|
`/actuator/\{id}` to `/manage/\{id}` (for example, `/manage/info`).
|
||||||
|
|
||||||
NOTE: Unless the management port has been configured to
|
NOTE: Unless the management port has been configured to
|
||||||
<<production-ready-customizing-management-server-port,expose endpoints by using a
|
<<production-ready-customizing-management-server-port,expose endpoints by using a
|
||||||
|
|
@ -1375,7 +1375,7 @@ https://micrometer.io/docs[reference documentation], in particular the
|
||||||
=== Getting started
|
=== Getting started
|
||||||
Spring Boot auto-configures a composite `MeterRegistry` and adds a registry to the
|
Spring Boot auto-configures a composite `MeterRegistry` and adds a registry to the
|
||||||
composite for each of the supported implementations that it finds on the classpath. Having
|
composite for each of the supported implementations that it finds on the classpath. Having
|
||||||
a dependency on `micrometer-registry-{system}` in your runtime classpath is enough for
|
a dependency on `micrometer-registry-\{system}` in your runtime classpath is enough for
|
||||||
Spring Boot to configure the registry.
|
Spring Boot to configure the registry.
|
||||||
|
|
||||||
Most registries share common features. For instance, you can disable a particular registry
|
Most registries share common features. For instance, you can disable a particular registry
|
||||||
|
|
@ -1846,7 +1846,7 @@ By default, Spring MVC-related metrics are tagged with the following information
|
||||||
|
|
||||||
|`uri`
|
|`uri`
|
||||||
|Request's URI template prior to variable substitution, if possible (for example,
|
|Request's URI template prior to variable substitution, if possible (for example,
|
||||||
`/api/person/{id}`)
|
`/api/person/\{id}`)
|
||||||
|
|
||||||
|===
|
|===
|
||||||
|
|
||||||
|
|
@ -1883,7 +1883,7 @@ By default, WebFlux-related metrics are tagged with the following information:
|
||||||
|
|
||||||
|`uri`
|
|`uri`
|
||||||
|Request's URI template prior to variable substitution, if possible (for example,
|
|Request's URI template prior to variable substitution, if possible (for example,
|
||||||
`/api/person/{id}`)
|
`/api/person/\{id}`)
|
||||||
|
|
||||||
|===
|
|===
|
||||||
|
|
||||||
|
|
@ -1940,7 +1940,7 @@ By default, Jersey server metrics are tagged with the following information:
|
||||||
|
|
||||||
|`uri`
|
|`uri`
|
||||||
|Request's URI template prior to variable substitution, if possible (for example,
|
|Request's URI template prior to variable substitution, if possible (for example,
|
||||||
`/api/person/{id}`)
|
`/api/person/\{id}`)
|
||||||
|
|
||||||
|===
|
|===
|
||||||
|
|
||||||
|
|
@ -1986,7 +1986,7 @@ or `IO_ERROR` in case or I/O issues, `CLIENT_ERROR` otherwise
|
||||||
|
|
||||||
|`uri`
|
|`uri`
|
||||||
|Request's URI template prior to variable substitution, if possible (for example,
|
|Request's URI template prior to variable substitution, if possible (for example,
|
||||||
`/api/person/{id}`)
|
`/api/person/\{id}`)
|
||||||
|
|
||||||
|===
|
|===
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -460,9 +460,9 @@ variable or system property).
|
||||||
. A `RandomValuePropertySource` that has properties only in `+random.*+`.
|
. A `RandomValuePropertySource` that has properties only in `+random.*+`.
|
||||||
. <<boot-features-external-config-profile-specific-properties,Profile-specific
|
. <<boot-features-external-config-profile-specific-properties,Profile-specific
|
||||||
application properties>> outside of your packaged jar
|
application properties>> outside of your packaged jar
|
||||||
(`application-{profile}.properties` and YAML variants).
|
(`application-\{profile}.properties` and YAML variants).
|
||||||
. <<boot-features-external-config-profile-specific-properties,Profile-specific
|
. <<boot-features-external-config-profile-specific-properties,Profile-specific
|
||||||
application properties>> packaged inside your jar (`application-{profile}.properties`
|
application properties>> packaged inside your jar (`application-\{profile}.properties`
|
||||||
and YAML variants).
|
and YAML variants).
|
||||||
. Application properties outside of your packaged jar (`application.properties` and YAML
|
. Application properties outside of your packaged jar (`application.properties` and YAML
|
||||||
variants).
|
variants).
|
||||||
|
|
@ -656,7 +656,7 @@ environment variables or system properties.
|
||||||
[[boot-features-external-config-profile-specific-properties]]
|
[[boot-features-external-config-profile-specific-properties]]
|
||||||
=== Profile-specific Properties
|
=== Profile-specific Properties
|
||||||
In addition to `application.properties` files, profile-specific properties can also be
|
In addition to `application.properties` files, profile-specific properties can also be
|
||||||
defined by using the following naming convention: `application-{profile}.properties`. The
|
defined by using the following naming convention: `application-\{profile}.properties`. The
|
||||||
`Environment` has a set of default profiles (by default, `[default]`) that are used if no
|
`Environment` has a set of default profiles (by default, `[default]`) that are used if no
|
||||||
active profiles are set. In other words, if no profiles are explicitly activated, then
|
active profiles are set. In other words, if no profiles are explicitly activated, then
|
||||||
properties from `application-default.properties` are loaded.
|
properties from `application-default.properties` are loaded.
|
||||||
|
|
@ -901,7 +901,7 @@ to using only one of them.
|
||||||
|
|
||||||
[[boot-features-external-config-typesafe-configuration-properties]]
|
[[boot-features-external-config-typesafe-configuration-properties]]
|
||||||
=== Type-safe Configuration Properties
|
=== Type-safe Configuration Properties
|
||||||
Using the `@Value("${property}")` annotation to inject configuration properties can
|
Using the `@Value("$\{property}")` annotation to inject configuration properties can
|
||||||
sometimes be cumbersome, especially if you are working with multiple properties or your
|
sometimes be cumbersome, especially if you are working with multiple properties or your
|
||||||
data is hierarchical in nature. Spring Boot provides an alternative method of working
|
data is hierarchical in nature. Spring Boot provides an alternative method of working
|
||||||
with properties that lets strongly typed beans govern and validate the configuration of
|
with properties that lets strongly typed beans govern and validate the configuration of
|
||||||
|
|
@ -2072,7 +2072,7 @@ as the delimiter between a property name and its default value and not use `:-`.
|
||||||
|
|
||||||
You can add MDC and other ad-hoc content to log lines by overriding only the
|
You can add MDC and other ad-hoc content to log lines by overriding only the
|
||||||
`LOG_LEVEL_PATTERN` (or `logging.pattern.level` with Logback). For example, if you use
|
`LOG_LEVEL_PATTERN` (or `logging.pattern.level` with Logback). For example, if you use
|
||||||
`logging.pattern.level=user:%X{user} %5p`, then the default log format contains an MDC
|
`logging.pattern.level=user:%X\{user} %5p`, then the default log format contains an MDC
|
||||||
entry for "user", if it exists, as shown in the following example.
|
entry for "user", if it exists, as shown in the following example.
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
@ -2256,17 +2256,17 @@ The following code shows a typical `@RestController` that serves JSON data:
|
||||||
@RequestMapping(value="/users")
|
@RequestMapping(value="/users")
|
||||||
public class MyRestController {
|
public class MyRestController {
|
||||||
|
|
||||||
@RequestMapping(value="/{user}", method=RequestMethod.GET)
|
@RequestMapping(value="/\{user}", method=RequestMethod.GET)
|
||||||
public User getUser(@PathVariable Long user) {
|
public User getUser(@PathVariable Long user) {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value="/{user}/customers", method=RequestMethod.GET)
|
@RequestMapping(value="/\{user}/customers", method=RequestMethod.GET)
|
||||||
List<Customer> getUserCustomers(@PathVariable Long user) {
|
List<Customer> getUserCustomers(@PathVariable Long user) {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value="/{user}", method=RequestMethod.DELETE)
|
@RequestMapping(value="/\{user}", method=RequestMethod.DELETE)
|
||||||
public User deleteUser(@PathVariable Long user) {
|
public User deleteUser(@PathVariable Long user) {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
@ -2857,17 +2857,17 @@ following example:
|
||||||
@RequestMapping("/users")
|
@RequestMapping("/users")
|
||||||
public class MyRestController {
|
public class MyRestController {
|
||||||
|
|
||||||
@GetMapping("/{user}")
|
@GetMapping("/\{user}")
|
||||||
public Mono<User> getUser(@PathVariable Long user) {
|
public Mono<User> getUser(@PathVariable Long user) {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{user}/customers")
|
@GetMapping("/\{user}/customers")
|
||||||
public Flux<Customer> getUserCustomers(@PathVariable Long user) {
|
public Flux<Customer> getUserCustomers(@PathVariable Long user) {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/{user}")
|
@DeleteMapping("/\{user}")
|
||||||
public Mono<User> deleteUser(@PathVariable Long user) {
|
public Mono<User> deleteUser(@PathVariable Long user) {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
@ -2885,9 +2885,9 @@ actual handling of the requests, as shown in the following example:
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public RouterFunction<ServerResponse> monoRouterFunction(UserHandler userHandler) {
|
public RouterFunction<ServerResponse> monoRouterFunction(UserHandler userHandler) {
|
||||||
return route(GET("/{user}").and(accept(APPLICATION_JSON)), userHandler::getUser)
|
return route(GET("/\{user}").and(accept(APPLICATION_JSON)), userHandler::getUser)
|
||||||
.andRoute(GET("/{user}/customers").and(accept(APPLICATION_JSON)), userHandler::getUserCustomers)
|
.andRoute(GET("/\{user}/customers").and(accept(APPLICATION_JSON)), userHandler::getUserCustomers)
|
||||||
.andRoute(DELETE("/{user}").and(accept(APPLICATION_JSON)), userHandler::deleteUser);
|
.andRoute(DELETE("/\{user}").and(accept(APPLICATION_JSON)), userHandler::deleteUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue