Commit f64d5303 authored by Phillip Johnson's avatar Phillip Johnson Committed by Andy Wilkinson

Document and test array support for spring.profiles.*

Closes gh-7175
Closes gh-6995
parent 919d0c61
...@@ -128,8 +128,8 @@ content into your application; rather pick only the properties that you need. ...@@ -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). spring.pid.file= # Location of the PID file to write (if ApplicationPidFileWriter is used).
# PROFILES # PROFILES
spring.profiles.active= # Comma-separated list of <<howto-set-active-spring-profiles,active 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. 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]) # SENDGRID ({sc-spring-boot-autoconfigure}/sendgrid/SendGridAutoConfiguration.{sc-ext}[SendGridAutoConfiguration])
spring.sendgrid.api-key= # SendGrid api key (alternative to username/password) spring.sendgrid.api-key= # SendGrid api key (alternative to username/password)
......
...@@ -1173,7 +1173,9 @@ For example, when an application with following properties is run using the swit ...@@ -1173,7 +1173,9 @@ For example, when an application with following properties is run using the swit
my.property: fromyamlfile my.property: fromyamlfile
--- ---
spring.profiles: prod 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 NOTE: Remember that the `spring.profiles` property can be defined in a YAML document
......
...@@ -536,6 +536,14 @@ public class ConfigFileApplicationListenerTests { ...@@ -536,6 +536,14 @@ public class ConfigFileApplicationListenerTests {
"healthcheck"); "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 @Test
public void yamlSetsMultiProfilesWithWhitespace() throws Exception { public void yamlSetsMultiProfilesWithWhitespace() throws Exception {
this.initializer.setSearchNames("testsetmultiprofileswhitespace"); this.initializer.setSearchNames("testsetmultiprofileswhitespace");
......
---
spring:
profiles:
active:
- dev
- healthcheck
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment