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
Add application listener to locate property sources during bootstrap
Also adds support for activating profiles using spring.profiles.active from bootstrap property source listeners.
Allow profiles to be passed from bootstrap context to main application context
Copy file name to clipboardExpand all lines: docs/src/main/asciidoc/_configprops.adoc
+1
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@
4
4
|spring.cloud.compatibility-verifier.compatible-boot-versions | | Default accepted versions for the Spring Boot dependency. You can set {@code x} for the patch version if you don't want to specify a concrete value. Example: {@code 3.4.x}
5
5
|spring.cloud.compatibility-verifier.enabled | `+++false+++` | Enables creation of Spring Cloud compatibility verification.
6
6
|spring.cloud.config.allow-override | `+++true+++` | Flag to indicate that {@link #isOverrideSystemProperties() systemPropertiesOverride} can be used. Set to false to prevent users from changing the default accidentally. Default true.
7
+
|spring.cloud.config.initialize-on-context-refresh | `+++false+++` | Flag to initialize bootstrap configuration on context refresh event. Default false.
7
8
|spring.cloud.config.override-none | `+++false+++` | Flag to indicate that when {@link #setAllowOverride(boolean) allowOverride} is true, external properties should take lowest priority and should not override any existing property sources (including local config files). Default false.
8
9
|spring.cloud.config.override-system-properties | `+++true+++` | Flag to indicate that the external properties should override system properties. Default true.
9
10
|spring.cloud.decrypt-environment-post-processor.enabled | `+++true+++` | Enable the DecryptEnvironmentPostProcessor.
Copy file name to clipboardExpand all lines: docs/src/main/asciidoc/spring-cloud-commons.adoc
+10
Original file line number
Diff line number
Diff line change
@@ -54,6 +54,10 @@ The additional property sources are:
54
54
An example would be properties from the Spring Cloud Config Server.
55
55
See "`<<customizing-bootstrap-property-sources>>`" for how to customize the contents of this property source.
56
56
57
+
NOTE: Prior to Spring Cloud 2021.0.7 `PropertySourceLocators` (including the ones for Spring Cloud Config) were run during
58
+
the main application context and not in the Bootstrap context. You can force `PropertySourceLocators` to be run during the
59
+
Bootstrap context by setting `spring.cloud.config.initialize-on-context-refresh=true` in `bootstrap.[properties | yaml]`.
60
+
57
61
* "`applicationConfig: [classpath:bootstrap.yml]`" (and related files if Spring profiles are active): If you have a `bootstrap.yml` (or `.properties`), those properties are used to configure the bootstrap context.
58
62
Then they get added to the child context when its parent is set.
59
63
They have lower precedence than the `application.yml` (or `.properties`) and any other property sources that are added to the child as a normal part of the process of creating a Spring Boot application.
As of Spring Cloud 2021.0.7, Spring Cloud will now call `PropertySourceLocators` twice. The first fetch
154
+
will retrieve any property sources without any profiles. These property sources will have the opportunity to
155
+
activate profiles using `spring.profiles.active`. After the main application context starts `PropertySourceLocators`
156
+
will be called a second time, this time with any active profiles allowing `PropertySourceLocators` to locate
157
+
any additional `PropertySources` with profiles.
158
+
149
159
=== Logging Configuration
150
160
151
161
If you use Spring Boot to configure log settings, you should place this configuration in `bootstrap.[yml | properties]` if you would like it to apply to all events.
Copy file name to clipboardExpand all lines: spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/config/PropertySourceBootstrapConfiguration.java
Copy file name to clipboardExpand all lines: spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/config/PropertySourceBootstrapProperties.java
+13
Original file line number
Diff line number
Diff line change
@@ -46,6 +46,19 @@ public class PropertySourceBootstrapProperties {
46
46
*/
47
47
privatebooleanoverrideNone = false;
48
48
49
+
/**
50
+
* Flag to initialize bootstrap configuration on context refresh event. Default false.
0 commit comments