Skip to content

Commit d63e609

Browse files
committed
Merge branch '2.5.x' into 2.6.x
Closes gh-30050
2 parents d11c5d3 + 58e2adb commit d63e609

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,18 +443,21 @@ For example, if a secret named `db.password` is mounted at location `/run/secret
443443

444444
[[features.external-config.files.property-placeholders]]
445445
==== Property Placeholders
446-
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).
446+
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).
447447
The standard `$\{name}` property-placeholder syntax can be used anywhere within a value.
448+
Property placeholders can also specify a default value using a `:` to separate the default value from the property name, for example `${name:default}`.
448449

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

451452
[source,yaml,indent=0,subs="verbatim",configblocks]
452453
----
453454
app:
454455
name: "MyApp"
455-
description: "${app.name} is a Spring Boot application"
456+
description: "${app.name} is a Spring Boot application written by ${username:Unknown}"
456457
----
457458

459+
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`.
460+
458461
TIP: You can also use this technique to create "`short`" variants of existing Spring Boot properties.
459462
See the _<<howto#howto.properties-and-configuration.short-command-line-arguments>>_ how-to for details.
460463

0 commit comments

Comments
 (0)