Skip to content

Commit f4e2d76

Browse files
committed
Merge branch '2.6.x' into 2.7.x
Closes gh-30051
2 parents 1910a3b + d63e609 commit f4e2d76

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/external-config.adoc

+6-3
Original file line numberDiff line numberDiff line change
@@ -440,18 +440,21 @@ For example, if a secret named `db.password` is mounted at location `/run/secret
440440

441441
[[features.external-config.files.property-placeholders]]
442442
==== Property Placeholders
443-
The values in `application.properties` and `application.yml` are filtered through the existing `Environment` when they are used, so you can refer back to previously defined values (for example, from System properties).
443+
The values in `application.properties` and `application.yml` are filtered through the existing `Environment` when they are used, so you can refer back to previously defined values (for example, from System properties or environment variables).
444444
The standard `$\{name}` property-placeholder syntax can be used anywhere within a value.
445+
Property placeholders can also specify a default value using a `:` to separate the default value from the property name, for example `${name:default}`.
445446

446-
For example, the following file will set `app.description` to "`MyApp is a Spring Boot application`":
447+
The use of placeholders with and without defaults is shown in the following example:
447448

448449
[source,yaml,indent=0,subs="verbatim",configblocks]
449450
----
450451
app:
451452
name: "MyApp"
452-
description: "${app.name} is a Spring Boot application"
453+
description: "${app.name} is a Spring Boot application written by ${username:Unknown}"
453454
----
454455

456+
Assuming that the `username` property has not be set elsewhere, `app.description` will have the value `MyApp is a Spring Boot application written by Unknown`.
457+
455458
TIP: You can also use this technique to create "`short`" variants of existing Spring Boot properties.
456459
See the _<<howto#howto.properties-and-configuration.short-command-line-arguments>>_ how-to for details.
457460

0 commit comments

Comments
 (0)