From 723c884a8940b9420f4ca2c8a75bb225a070381c Mon Sep 17 00:00:00 2001
From: buildmaster spring-jdbc t
If you include the right dependencies on the classpath (see the user guide for more details on that), Spring Boot configures a data source.
The database needs to have a table called PROPERTIES with columns called APPLICATION, PROFILE, and LABEL (with the usual Environment meaning), plus KEY and VALUE for the key and value pairs in Properties style.
All fields are of type String in Java, so you can make them VARCHAR of whatever length you need.
Property values behave in the same way as they would if they came from Spring Boot properties files named {application}-{profile}.properties, including all the encryption and decryption, which will be applied as post-processing steps (that is, not in the repository implementation directly).
In some scenarios, you may wish to pull configuration data from multiple environment repositories. -To do so, you can enable multiple profiles in your config server’s application properties or YAML file. -If, for example, you want to pull configuration data from a Git repository as well as an SVN repository, you can set the following properties for your configuration server:
spring: +To do so, you can enable thecompositeprofile in your configuration server’s application properties or YAML file. +If, for example, you want to pull configuration data from a Subversion repository as well as two Git repositories, you can set the following properties for your configuration server:spring: profiles: - active: git, svn + active: composite cloud: config: server: - svn: + composite: + - + type: svn uri: file:///path/to/svn/repo - order: 2 + - + type: git + uri: file:///path/to/rex/git/repo + - + type: git + uri: file:///path/to/walter/git/repoUsing this configuration, precedence is determined by the order in which repositories are listed under the
compositekey. +In the above example, the Subversion repository is listed first, so a value found in the Subversion repository will override values found for the same property in one of the Git repositories. +A value found in therexGit repository will be used before a value found for the same property in thewalterGit repository.If you want to pull configuration data only from repositories that are each of distinct types, you can enable the corresponding profiles, rather than the
compositeprofile, in your configuration server’s application properties or YAML file. +If, for example, you want to pull configuration data from a single Git repository and a single Subversion repository, you can set the following properties for your configuration server:spring: + profiles: + active: git, subversion + cloud: + config: + server: git: uri: file:///path/to/git/repo - order: 1In addition to each repository specifying a URI, you can also specify an
orderproperty. -Theorderproperty lets you specify the priority order for all your repositories. + order: 2 + svn: + uri: file:///path/to/svn/repo + order: 1
Using this configuration, precedence can be determined by an order property.
+You can use the order property to specify the priority order for all your repositories.
The lower the numerical value of the order property, the higher priority it has.
The priority order of a repository helps resolve any potential conflicts between repositories that contain values for the same properties.
![]() | Note |
|---|---|
Any type of failure when retrieving values from an environment repository results in a failure for the entire composite environment. |
![]() | Note |
|---|---|
When using a composite environment, it is important that all repositories contain the same labels.
-If you have an environment similar to the one in the preceding example and you request configuration data with the |
In addition to using one of the environment repositories from Spring Cloud, you can also provide your own EnvironmentRepository bean to be included as part of a composite environment.
+If you have an environment similar to those in the preceding examples and you request configuration data with the master label but the Subversion repository does not contain a branch called master, the entire request fails.
In addition to using one of the environment repositories from Spring Cloud, you can also provide your own EnvironmentRepository bean to be included as part of a composite environment.
To do so, your bean must implement the EnvironmentRepository interface.
If you want to control the priority of your custom EnvironmentRepository within the composite environment, you should also implement the Ordered interface and override the getOrdered method.
If you do not implement the Ordered interface, your EnvironmentRepository is given the lowest priority.
The Config Server has an “overrides” feature that lets the operator provide configuration properties to all applications.
diff --git a/single/spring-cloud-config.html b/single/spring-cloud-config.html
index eaad4cd0..3b495c56 100644
--- a/single/spring-cloud-config.html
+++ b/single/spring-cloud-config.html
@@ -376,23 +376,41 @@ You can enable this feature by adding spring-jdbc t
If you include the right dependencies on the classpath (see the user guide for more details on that), Spring Boot configures a data source.
The database needs to have a table called PROPERTIES with columns called APPLICATION, PROFILE, and LABEL (with the usual Environment meaning), plus KEY and VALUE for the key and value pairs in Properties style.
All fields are of type String in Java, so you can make them VARCHAR of whatever length you need.
Property values behave in the same way as they would if they came from Spring Boot properties files named {application}-{profile}.properties, including all the encryption and decryption, which will be applied as post-processing steps (that is, not in the repository implementation directly).
In some scenarios, you may wish to pull configuration data from multiple environment repositories. -To do so, you can enable multiple profiles in your config server’s application properties or YAML file. -If, for example, you want to pull configuration data from a Git repository as well as an SVN repository, you can set the following properties for your configuration server:
spring: +To do so, you can enable thecompositeprofile in your configuration server’s application properties or YAML file. +If, for example, you want to pull configuration data from a Subversion repository as well as two Git repositories, you can set the following properties for your configuration server:spring: profiles: - active: git, svn + active: composite cloud: config: server: - svn: + composite: + - + type: svn uri: file:///path/to/svn/repo - order: 2 + - + type: git + uri: file:///path/to/rex/git/repo + - + type: git + uri: file:///path/to/walter/git/repoUsing this configuration, precedence is determined by the order in which repositories are listed under the
compositekey. +In the above example, the Subversion repository is listed first, so a value found in the Subversion repository will override values found for the same property in one of the Git repositories. +A value found in therexGit repository will be used before a value found for the same property in thewalterGit repository.If you want to pull configuration data only from repositories that are each of distinct types, you can enable the corresponding profiles, rather than the
compositeprofile, in your configuration server’s application properties or YAML file. +If, for example, you want to pull configuration data from a single Git repository and a single Subversion repository, you can set the following properties for your configuration server:spring: + profiles: + active: git, subversion + cloud: + config: + server: git: uri: file:///path/to/git/repo - order: 1In addition to each repository specifying a URI, you can also specify an
orderproperty. -Theorderproperty lets you specify the priority order for all your repositories. + order: 2 + svn: + uri: file:///path/to/svn/repo + order: 1
Using this configuration, precedence can be determined by an order property.
+You can use the order property to specify the priority order for all your repositories.
The lower the numerical value of the order property, the higher priority it has.
The priority order of a repository helps resolve any potential conflicts between repositories that contain values for the same properties.
![]() | Note |
|---|---|
Any type of failure when retrieving values from an environment repository results in a failure for the entire composite environment. |
![]() | Note |
|---|---|
When using a composite environment, it is important that all repositories contain the same labels.
-If you have an environment similar to the one in the preceding example and you request configuration data with the |
In addition to using one of the environment repositories from Spring Cloud, you can also provide your own EnvironmentRepository bean to be included as part of a composite environment.
+If you have an environment similar to those in the preceding examples and you request configuration data with the master label but the Subversion repository does not contain a branch called master, the entire request fails.
In addition to using one of the environment repositories from Spring Cloud, you can also provide your own EnvironmentRepository bean to be included as part of a composite environment.
To do so, your bean must implement the EnvironmentRepository interface.
If you want to control the priority of your custom EnvironmentRepository within the composite environment, you should also implement the Ordered interface and override the getOrdered method.
If you do not implement the Ordered interface, your EnvironmentRepository is given the lowest priority.
The Config Server has an “overrides” feature that lets the operator provide configuration properties to all applications.
diff --git a/spring-cloud-config.xml b/spring-cloud-config.xml
index f6a729a8..a6930db3 100644
--- a/spring-cloud-config.xml
+++ b/spring-cloud-config.xml
@@ -719,22 +719,43 @@ Property values behave in the same way as they would if they came from Spring Bo