Skip to content

Commit dc31f61

Browse files
committed
Document limitations of YAML documents & profile-specific files
Fixes spring-projectsgh-15790
1 parent 688eb89 commit dc31f61

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc

+20
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,26 @@ negated profiles may match.
835835
YAML files cannot be loaded by using the `@PropertySource` annotation. So, in the case
836836
that you need to load values that way, you need to use a properties file.
837837

838+
Using the multi YAML document syntax in profile-specific YAML files can lead to unexpected
839+
behavior. For example, consider the following config in a file called `application-dev.yml`,
840+
with the `dev` profile being active:
841+
842+
[source,yaml,indent=0]
843+
----
844+
server:
845+
port: 8000
846+
---
847+
spring:
848+
profiles: !test
849+
security:
850+
user:
851+
password: weak
852+
----
853+
854+
In the example above, profile negation and profile expressions will not behave as expected.
855+
We recommend that you don't combine profile-specific YAML files and multiple YAML documents and stick
856+
to using only one of them.
857+
838858

839859

840860
[[boot-features-external-config-typesafe-configuration-properties]]

0 commit comments

Comments
 (0)