You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
YAML files cannot be loaded by using the `@PropertySource` annotation.
1052
-
So, in the case that you need to load values that way, you need to use a properties file.
1053
-
1054
-
Using the multi-document YAML syntax in profile-specific YAML files can lead to unexpected behavior.
1055
-
For example, consider the following config in a file:
1056
-
1057
-
.application-dev.yml
1058
-
[source,yaml,indent=0]
1059
-
----
1060
-
server.port: 8000
1061
-
---
1062
-
spring.config.activate.on-profile: "!test"
1063
-
mypassword: "secret"
1064
-
----
1065
-
1066
-
If you run the application with the argument `--spring.profiles.active=dev` you might expect `mypassword` to be set to "`secret`", but this is not the case.
1067
-
1068
-
The nested document will be filtered because the main file is named `application-dev.yml`.
1069
-
It is already considered to be profile-specific, and nested documents will be ignored.
1070
-
1071
-
TIP: We recommend that you don't mix profile-specific YAML files and multiple YAML documents.
1072
-
Stick to using only one of them.
1073
-
1074
-
1075
-
1076
1049
[[boot-features-external-config-random-values]]
1077
1050
=== Configuring Random Values
1078
1051
The `RandomValuePropertySource` is useful for injecting random values (for example, into secrets or test cases).
0 commit comments