Document and test array support for spring.profiles.*

Closes gh-7175
Closes gh-6995
This commit is contained in:
Phillip Johnson 2016-10-18 00:38:52 -04:00 committed by Andy Wilkinson
parent 919d0c6172
commit f64d5303cf
4 changed files with 19 additions and 3 deletions

View File

@ -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 <<howto-set-active-spring-profiles,active profiles>>.
spring.profiles.include= # Unconditionally activate the specified comma separated profiles.
spring.profiles.active= # Comma-separated list (or list if using YAML) of <<howto-set-active-spring-profiles,active profiles>>.
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)

View File

@ -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

View File

@ -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");

View File

@ -0,0 +1,6 @@
---
spring:
profiles:
active:
- dev
- healthcheck