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/antora/modules/reference/pages/features/external-config.adoc
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,8 @@ Property values can be injected directly into your beans by using the javadoc:or
8
8
9
9
Spring Boot uses a very particular javadoc:org.springframework.core.env.PropertySource[] order that is designed to allow sensible overriding of values.
10
10
Later property sources can override the values defined in earlier ones.
11
+
12
+
[[features.external-config.order]]
11
13
Sources are considered in the following order:
12
14
13
15
. Default properties (specified by setting javadoc:org.springframework.boot.SpringApplication#setDefaultProperties(java.util.Map)[]).
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/profiles.adoc
+11-4Lines changed: 11 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -53,16 +53,19 @@ spring:
53
53
active: "metrics"
54
54
----
55
55
56
+
The configprop:spring.profiles.active[] property follows the same ordering rules as other properties.
57
+
The highest javadoc:org.springframework.core.env.PropertySource[] wins.
58
+
This means that you can specify active profiles in `application.properties` and then *replace* them by using the command line switch.
59
+
60
+
TIP: See xref:features/external-config.adoc#features.external-config.order[the "`Externalized Configuration`"] for more details on the order in which property sources are considered.
61
+
56
62
57
63
58
64
[[features.profiles.adding-active-profiles]]
59
65
== Adding Active Profiles
60
66
61
-
The configprop:spring.profiles.active[] property follows the same ordering rules as other properties: The highest javadoc:org.springframework.core.env.PropertySource[] wins.
62
-
This means that you can specify active profiles in `application.properties` and then *replace* them by using the command line switch.
63
-
64
67
Sometimes, it is useful to have properties that *add* to the active profiles rather than replace them.
65
-
The `spring.profiles.include` property can be used to add active profiles on top of those activated by the configprop:spring.profiles.active[] property.
68
+
The configprop:spring.profiles.include[] property can be used to add active profiles on top of those activated by the configprop:spring.profiles.active[] property.
66
69
The javadoc:org.springframework.boot.SpringApplication[] entry point also has a Java API for setting additional profiles.
67
70
See the `setAdditionalProfiles()` method in javadoc:org.springframework.boot.SpringApplication[].
68
71
@@ -77,6 +80,10 @@ spring:
77
80
- "local"
78
81
----
79
82
83
+
NOTE: Included profiles are added before any configprop:spring.profiles.active[] profiles.
84
+
85
+
TIP: The configprop:spring.profiles.include[] property is processed for each property source, as such the usual xref:features/external-config.adoc#features.external-config.typesafe-configuration-properties.merging-complex-types[complex type merging rules] for lists do not apply.
86
+
80
87
WARNING: Similar to `spring.profiles.active`, `spring.profiles.include` can only be used in non-profile-specific documents.
81
88
This means it cannot be included in xref:features/external-config.adoc#features.external-config.files.profile-specific[profile specific files] or xref:features/external-config.adoc#features.external-config.files.activation-properties[documents activated] by `spring.config.activate.on-profile`.
0 commit comments