You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/profiles.adoc
+38-1Lines changed: 38 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,27 @@ The name of the default profile is `default` and it can be tuned using the confi
34
34
default: "none"
35
35
----
36
36
37
+
`spring.profiles.active` and `spring.profiles.default` can only be used in non-profile specific documents.
38
+
This means they cannot be included in <<features#features.external-config.files.profile-specific,profile specific files>> or <<features#features.external-config.files.activation-properties,documents activated>> by `spring.config.activate.on-profile`.
39
+
40
+
For example, the second document configuration is invalid:
@@ -42,8 +63,24 @@ The configprop:spring.profiles.active[] property follows the same ordering rules
42
63
This means that you can specify active profiles in `application.properties` and then *replace* them by using the command line switch.
43
64
44
65
Sometimes, it is useful to have properties that *add* to the active profiles rather than replace them.
45
-
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).
66
+
The `spring.profiles.include` property can be used to add active profiles on top of those activated by the configprop:spring.profiles.active[] property.
67
+
The `SpringApplication` entry point also has a Java API for setting additional profiles.
46
68
See the `setAdditionalProfiles()` method in {spring-boot-module-api}/SpringApplication.html[SpringApplication].
69
+
70
+
For example, when an application with the following properties is run, the common and local profiles will be activated even when it runs using the --spring.profiles.active switch:
WARNING: Similar to `spring.profiles.active`, `spring.profiles.include` can only be used in non-profile specific documents.
82
+
This means it cannot be included in <<features#features.external-config.files.profile-specific,profile specific files>> or <<features#features.external-config.files.activation-properties,documents activated>> by `spring.config.activate.on-profile`.
83
+
47
84
Profile groups, which are described in the <<features#features.profiles.groups,next section>> can also be used to add active profiles if a given profile is active.
0 commit comments