YAML files cannot be loaded by using the `@PropertySource` annotation.
So, in the case that you need to load values that way, you need to use a properties file.
Using the multi-document YAML syntax in profile-specific YAML files can lead to unexpected behavior.
For example, consider the following config in a file:
.application-dev.yml
[source,yaml,indent=0]
----
server.port: 8000
---
spring.config.activate.on-profile: "!test"
mypassword: "secret"
----
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.
The nested document will be filtered because the main file is named `application-dev.yml`.
It is already considered to be profile-specific, and nested documents will be ignored.
TIP: We recommend that you don't mix profile-specific YAML files and multiple YAML documents.
Stick to using only one of them.
[[boot-features-external-config-random-values]]
[[boot-features-external-config-random-values]]
=== Configuring Random Values
=== Configuring Random Values
The `RandomValuePropertySource` is useful for injecting random values (for example, into secrets or test cases).
The `RandomValuePropertySource` is useful for injecting random values (for example, into secrets or test cases).