diff --git a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc index 8cfeefbbd7..3c41553d81 100644 --- a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc +++ b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc @@ -128,8 +128,8 @@ content into your application; rather pick only the properties that you need. spring.pid.file= # Location of the PID file to write (if ApplicationPidFileWriter is used). # PROFILES - spring.profiles.active= # Comma-separated list of <>. - spring.profiles.include= # Unconditionally activate the specified comma separated profiles. + spring.profiles.active= # Comma-separated list (or list if using YAML) of <>. + spring.profiles.include= # Unconditionally activate the specified comma separated profiles (or list of profiles if using YAML). # SENDGRID ({sc-spring-boot-autoconfigure}/sendgrid/SendGridAutoConfiguration.{sc-ext}[SendGridAutoConfiguration]) spring.sendgrid.api-key= # SendGrid api key (alternative to username/password) diff --git a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index c8b29eecd5..5c9de27990 100644 --- a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -1173,7 +1173,9 @@ For example, when an application with following properties is run using the swit my.property: fromyamlfile --- spring.profiles: prod - spring.profiles.include: proddb,prodmq + spring.profiles.include: + - proddb + - prodmq ---- NOTE: Remember that the `spring.profiles` property can be defined in a YAML document diff --git a/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java index 5461a70b48..4221a73229 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java @@ -536,6 +536,14 @@ public class ConfigFileApplicationListenerTests { "healthcheck"); } + @Test + public void yamlSetsMultiProfilesWhenListProvided() throws Exception { + this.initializer.setSearchNames("testsetmultiprofileslist"); + this.initializer.postProcessEnvironment(this.environment, this.application); + assertThat(this.environment.getActiveProfiles()).containsExactly("dev", + "healthcheck"); + } + @Test public void yamlSetsMultiProfilesWithWhitespace() throws Exception { this.initializer.setSearchNames("testsetmultiprofileswhitespace"); diff --git a/spring-boot/src/test/resources/testsetmultiprofileslist.yml b/spring-boot/src/test/resources/testsetmultiprofileslist.yml new file mode 100644 index 0000000000..02deecd5ba --- /dev/null +++ b/spring-boot/src/test/resources/testsetmultiprofileslist.yml @@ -0,0 +1,6 @@ +--- +spring: + profiles: + active: + - dev + - healthcheck \ No newline at end of file