@ -1742,21 +1742,9 @@ The configprop:spring.profiles.active[] property follows the same ordering rules
@@ -1742,21 +1742,9 @@ The configprop:spring.profiles.active[] property follows the same ordering rules
This means that you can specify active profiles in `application.properties` and then *replace* them by using the command line switch.
Sometimes, it is useful to have properties that *add* to the active profiles rather than replace them.
The configprop:spring.profiles.include[] property can be used to unconditionally add active profiles.
The `SpringApplication` entry point also has a Java API for setting additional profiles (that is, on top of those activated by the configprop:spring.profiles.active[] property).
The `SpringApplication` entry point has a Java API for setting additional profiles (that is, on top of those activated by the configprop:spring.profiles.active[] property).
See the `setAdditionalProfiles()` method in {spring-boot-module-api}/SpringApplication.html[SpringApplication].
For example, when an application with the following properties is run by using the switch, `--spring.profiles.active=custom`, the `other` and `extra` profiles are still activated:
[source,yaml,indent=0]
----
---
my.property: fromyamlfile
spring.profiles.include:
- other
- extra
----
Profile groups, which are described in the <<boot-features-profiles-groups,next section>> can also be used to add active profiles if a given profile is active.
@ -43,6 +43,10 @@ public class InvalidConfigDataPropertyException extends ConfigDataException {
@@ -43,6 +43,10 @@ public class InvalidConfigDataPropertyException extends ConfigDataException {