From 2c2f0124d25c45100dea568ce169960696f55361 Mon Sep 17 00:00:00 2001 From: Kamalakar Ponaka Date: Mon, 11 Jan 2021 16:19:31 -0600 Subject: [PATCH 1/7] CF Auth issue with Instance certificate issue expiry for 2.2.x (#1713) * Update PcfClientAuthenticationProvider.java Removing CF Cert Cache. https://github.com/spring-cloud/spring-cloud-config/issues/1693 * fix for 2.2.x Co-authored-by: Kamalakar Fixes gh-1693 --- .../PcfClientAuthenticationProvider.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/vault/authentication/PcfClientAuthenticationProvider.java b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/vault/authentication/PcfClientAuthenticationProvider.java index 1b7d0cd6..c9a4daad 100644 --- a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/vault/authentication/PcfClientAuthenticationProvider.java +++ b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/vault/authentication/PcfClientAuthenticationProvider.java @@ -20,6 +20,7 @@ import org.springframework.cloud.config.server.environment.VaultEnvironmentPrope import org.springframework.cloud.config.server.environment.VaultEnvironmentProperties.AuthenticationMethod; import org.springframework.cloud.config.server.environment.vault.SpringVaultClientAuthenticationProvider; import org.springframework.util.Assert; +import org.springframework.util.StringUtils; import org.springframework.vault.authentication.ClientAuthentication; import org.springframework.vault.authentication.PcfAuthentication; import org.springframework.vault.authentication.PcfAuthenticationOptions; @@ -53,13 +54,33 @@ public class PcfClientAuthenticationProvider builder.instanceCertificate(new ResourceCredentialSupplier( pcfProperties.getInstanceCertificate())); } + else { + builder.instanceCertificate(new ResourceCredentialSupplier( + resolveEnvVariable("CF_INSTANCE_CERT"))); + } if (pcfProperties.getInstanceKey() != null) { builder.instanceKey( new ResourceCredentialSupplier(pcfProperties.getInstanceKey())); } + else { + builder.instanceKey(new ResourceCredentialSupplier( + resolveEnvVariable("CF_INSTANCE_KEY"))); + } return new PcfAuthentication(builder.build(), vaultRestOperations); } + private static String resolveEnvVariable(String name) { + + String value = System.getenv(name); + + if (StringUtils.isEmpty(value)) { + throw new IllegalStateException( + String.format("Environment variable %s not set", name)); + } + + return value; + } + } From ce0cd0125ca6b8ac7de62ce7152339ed2a1f6d0e Mon Sep 17 00:00:00 2001 From: buildmaster Date: Thu, 11 Feb 2021 13:50:56 +0000 Subject: [PATCH 2/7] Update SNAPSHOT to 2.2.7.RELEASE --- README.adoc | 2 +- docs/pom.xml | 2 +- docs/src/main/asciidoc/_configprops.adoc | 34 +++++++++++--------- pom.xml | 6 ++-- spring-cloud-config-client-tls-tests/pom.xml | 2 +- spring-cloud-config-client/pom.xml | 2 +- spring-cloud-config-dependencies/pom.xml | 4 +-- spring-cloud-config-monitor/pom.xml | 2 +- spring-cloud-config-sample/pom.xml | 2 +- spring-cloud-config-server/pom.xml | 2 +- spring-cloud-starter-config/pom.xml | 4 +-- 11 files changed, 32 insertions(+), 30 deletions(-) diff --git a/README.adoc b/README.adoc index e6dc23b7..b368da2f 100644 --- a/README.adoc +++ b/README.adoc @@ -223,7 +223,7 @@ The refresh endpoint reports that the "sample" property changed. == Building -:jdkversion: 1.7 +:jdkversion: 1.8 === Basic Compile and Test diff --git a/docs/pom.xml b/docs/pom.xml index 2d73da69..055f8803 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -8,7 +8,7 @@ org.springframework.cloud spring-cloud-config - 2.2.7.BUILD-SNAPSHOT + 2.2.7.RELEASE .. diff --git a/docs/src/main/asciidoc/_configprops.adoc b/docs/src/main/asciidoc/_configprops.adoc index 595be92b..3ad76cdb 100644 --- a/docs/src/main/asciidoc/_configprops.adoc +++ b/docs/src/main/asciidoc/_configprops.adoc @@ -1,27 +1,29 @@ |=== |Name | Default | Description -|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. -|spring.cloud.config.discovery.enabled | false | Flag to indicate that config server discovery is enabled (config server URL will be looked up via discovery). -|spring.cloud.config.discovery.service-id | configserver | Service id to locate config server. -|spring.cloud.config.enabled | true | Flag to say that remote configuration is enabled. Default true; -|spring.cloud.config.fail-fast | false | Flag to indicate that failure to connect to the server is fatal (default false). +|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. +|spring.cloud.config.discovery.enabled | `false` | Flag to indicate that config server discovery is enabled (config server URL will be looked up via discovery). +|spring.cloud.config.discovery.service-id | `configserver` | Service id to locate config server. +|spring.cloud.config.enabled | `true` | Flag to say that remote configuration is enabled. Default true; +|spring.cloud.config.fail-fast | `false` | Flag to indicate that failure to connect to the server is fatal (default false). |spring.cloud.config.headers | | Additional headers used to create the client request. |spring.cloud.config.label | | The label name to use to pull remote configuration properties. The default is set on the server (generally "master" for a git based server). +|spring.cloud.config.media-type | | The Accept header media type to send to config server. |spring.cloud.config.name | | Name of application used to fetch remote properties. -|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. -|spring.cloud.config.override-system-properties | true | Flag to indicate that the external properties should override system properties. Default true. +|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. +|spring.cloud.config.override-system-properties | `true` | Flag to indicate that the external properties should override system properties. Default true. |spring.cloud.config.password | | The password to use (HTTP Basic) when contacting the remote server. -|spring.cloud.config.profile | default | The default profile to use when fetching remote configuration (comma-separated). Default is "default". -|spring.cloud.config.request-connect-timeout | 0 | timeout on waiting to connect to the Config Server. -|spring.cloud.config.request-read-timeout | 0 | timeout on waiting to read data from the Config Server. -|spring.cloud.config.retry.initial-interval | 1000 | Initial retry interval in milliseconds. -|spring.cloud.config.retry.max-attempts | 6 | Maximum number of attempts. -|spring.cloud.config.retry.max-interval | 2000 | Maximum interval for backoff. -|spring.cloud.config.retry.multiplier | 1.1 | Multiplier for next interval. -|spring.cloud.config.send-state | true | Flag to indicate whether to send state. Default true. +|spring.cloud.config.profile | `default` | The default profile to use when fetching remote configuration (comma-separated). Default is "default". +|spring.cloud.config.request-connect-timeout | `0` | timeout on waiting to connect to the Config Server. +|spring.cloud.config.request-read-timeout | `0` | timeout on waiting to read data from the Config Server. +|spring.cloud.config.retry.initial-interval | `1000` | Initial retry interval in milliseconds. +|spring.cloud.config.retry.max-attempts | `6` | Maximum number of attempts. +|spring.cloud.config.retry.max-interval | `2000` | Maximum interval for backoff. +|spring.cloud.config.retry.multiplier | `1.1` | Multiplier for next interval. +|spring.cloud.config.send-state | `true` | Flag to indicate whether to send state. Default true. +|spring.cloud.config.tls | | TLS properties. |spring.cloud.config.token | | Security Token passed thru to underlying environment repository. -|spring.cloud.config.uri | [http://localhost:8888] | The URI of the remote server (default http://localhost:8888). +|spring.cloud.config.uri | `[http://localhost:8888]` | The URI of the remote server (default http://localhost:8888). |spring.cloud.config.username | | The username to use (HTTP Basic) when contacting the remote server. |=== \ No newline at end of file diff --git a/pom.xml b/pom.xml index 635c2d4f..c3ccc6fe 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.springframework.cloud spring-cloud-config - 2.2.7.BUILD-SNAPSHOT + 2.2.7.RELEASE pom Spring Cloud Config Spring Cloud Config @@ -13,7 +13,7 @@ org.springframework.cloud spring-cloud-build - 2.3.1.RELEASE + 2.3.2.RELEASE @@ -27,7 +27,7 @@ config - 2.2.7.BUILD-SNAPSHOT + 2.2.7.RELEASE 1.11.52 v1-rev20191010-1.30.3 true diff --git a/spring-cloud-config-client-tls-tests/pom.xml b/spring-cloud-config-client-tls-tests/pom.xml index e3f65420..7b0fcdd8 100644 --- a/spring-cloud-config-client-tls-tests/pom.xml +++ b/spring-cloud-config-client-tls-tests/pom.xml @@ -10,7 +10,7 @@ org.springframework.cloud spring-cloud-config - 2.2.7.BUILD-SNAPSHOT + 2.2.7.RELEASE .. diff --git a/spring-cloud-config-client/pom.xml b/spring-cloud-config-client/pom.xml index 6814034f..60069d28 100644 --- a/spring-cloud-config-client/pom.xml +++ b/spring-cloud-config-client/pom.xml @@ -10,7 +10,7 @@ org.springframework.cloud spring-cloud-config - 2.2.7.BUILD-SNAPSHOT + 2.2.7.RELEASE .. diff --git a/spring-cloud-config-dependencies/pom.xml b/spring-cloud-config-dependencies/pom.xml index 370adf47..809fac3e 100644 --- a/spring-cloud-config-dependencies/pom.xml +++ b/spring-cloud-config-dependencies/pom.xml @@ -6,11 +6,11 @@ spring-cloud-dependencies-parent org.springframework.cloud - 2.3.2.BUILD-SNAPSHOT + 2.3.2.RELEASE spring-cloud-config-dependencies - 2.2.7.BUILD-SNAPSHOT + 2.2.7.RELEASE pom spring-cloud-config-dependencies Spring Cloud Config Dependencies diff --git a/spring-cloud-config-monitor/pom.xml b/spring-cloud-config-monitor/pom.xml index 9690933c..6b311902 100644 --- a/spring-cloud-config-monitor/pom.xml +++ b/spring-cloud-config-monitor/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-config - 2.2.7.BUILD-SNAPSHOT + 2.2.7.RELEASE .. spring-cloud-config-monitor diff --git a/spring-cloud-config-sample/pom.xml b/spring-cloud-config-sample/pom.xml index 1e802f4a..c1ff38ab 100644 --- a/spring-cloud-config-sample/pom.xml +++ b/spring-cloud-config-sample/pom.xml @@ -13,7 +13,7 @@ org.springframework.cloud spring-cloud-config - 2.2.7.BUILD-SNAPSHOT + 2.2.7.RELEASE .. diff --git a/spring-cloud-config-server/pom.xml b/spring-cloud-config-server/pom.xml index c174798a..da96146b 100644 --- a/spring-cloud-config-server/pom.xml +++ b/spring-cloud-config-server/pom.xml @@ -13,7 +13,7 @@ org.springframework.cloud spring-cloud-config - 2.2.7.BUILD-SNAPSHOT + 2.2.7.RELEASE .. diff --git a/spring-cloud-starter-config/pom.xml b/spring-cloud-starter-config/pom.xml index 6f6d4626..9eaf900e 100644 --- a/spring-cloud-starter-config/pom.xml +++ b/spring-cloud-starter-config/pom.xml @@ -6,10 +6,10 @@ org.springframework.cloud spring-cloud-config - 2.2.7.BUILD-SNAPSHOT + 2.2.7.RELEASE spring-cloud-starter-config - 2.2.7.BUILD-SNAPSHOT + 2.2.7.RELEASE spring-cloud-starter-config Spring Cloud Starter https://projects.spring.io/spring-cloud From f1ab6d442f7e033bc0105fe9ac69567da92a5945 Mon Sep 17 00:00:00 2001 From: buildmaster Date: Thu, 11 Feb 2021 13:53:28 +0000 Subject: [PATCH 3/7] Going back to snapshots --- README.adoc | 2 +- docs/pom.xml | 2 +- docs/src/main/asciidoc/_configprops.adoc | 34 +++++++++----------- pom.xml | 6 ++-- spring-cloud-config-client-tls-tests/pom.xml | 2 +- spring-cloud-config-client/pom.xml | 2 +- spring-cloud-config-dependencies/pom.xml | 4 +-- spring-cloud-config-monitor/pom.xml | 2 +- spring-cloud-config-sample/pom.xml | 2 +- spring-cloud-config-server/pom.xml | 2 +- spring-cloud-starter-config/pom.xml | 4 +-- 11 files changed, 30 insertions(+), 32 deletions(-) diff --git a/README.adoc b/README.adoc index b368da2f..e6dc23b7 100644 --- a/README.adoc +++ b/README.adoc @@ -223,7 +223,7 @@ The refresh endpoint reports that the "sample" property changed. == Building -:jdkversion: 1.8 +:jdkversion: 1.7 === Basic Compile and Test diff --git a/docs/pom.xml b/docs/pom.xml index 055f8803..2d73da69 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -8,7 +8,7 @@ org.springframework.cloud spring-cloud-config - 2.2.7.RELEASE + 2.2.7.BUILD-SNAPSHOT .. diff --git a/docs/src/main/asciidoc/_configprops.adoc b/docs/src/main/asciidoc/_configprops.adoc index 3ad76cdb..595be92b 100644 --- a/docs/src/main/asciidoc/_configprops.adoc +++ b/docs/src/main/asciidoc/_configprops.adoc @@ -1,29 +1,27 @@ |=== |Name | Default | Description -|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. -|spring.cloud.config.discovery.enabled | `false` | Flag to indicate that config server discovery is enabled (config server URL will be looked up via discovery). -|spring.cloud.config.discovery.service-id | `configserver` | Service id to locate config server. -|spring.cloud.config.enabled | `true` | Flag to say that remote configuration is enabled. Default true; -|spring.cloud.config.fail-fast | `false` | Flag to indicate that failure to connect to the server is fatal (default false). +|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. +|spring.cloud.config.discovery.enabled | false | Flag to indicate that config server discovery is enabled (config server URL will be looked up via discovery). +|spring.cloud.config.discovery.service-id | configserver | Service id to locate config server. +|spring.cloud.config.enabled | true | Flag to say that remote configuration is enabled. Default true; +|spring.cloud.config.fail-fast | false | Flag to indicate that failure to connect to the server is fatal (default false). |spring.cloud.config.headers | | Additional headers used to create the client request. |spring.cloud.config.label | | The label name to use to pull remote configuration properties. The default is set on the server (generally "master" for a git based server). -|spring.cloud.config.media-type | | The Accept header media type to send to config server. |spring.cloud.config.name | | Name of application used to fetch remote properties. -|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. -|spring.cloud.config.override-system-properties | `true` | Flag to indicate that the external properties should override system properties. Default true. +|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. +|spring.cloud.config.override-system-properties | true | Flag to indicate that the external properties should override system properties. Default true. |spring.cloud.config.password | | The password to use (HTTP Basic) when contacting the remote server. -|spring.cloud.config.profile | `default` | The default profile to use when fetching remote configuration (comma-separated). Default is "default". -|spring.cloud.config.request-connect-timeout | `0` | timeout on waiting to connect to the Config Server. -|spring.cloud.config.request-read-timeout | `0` | timeout on waiting to read data from the Config Server. -|spring.cloud.config.retry.initial-interval | `1000` | Initial retry interval in milliseconds. -|spring.cloud.config.retry.max-attempts | `6` | Maximum number of attempts. -|spring.cloud.config.retry.max-interval | `2000` | Maximum interval for backoff. -|spring.cloud.config.retry.multiplier | `1.1` | Multiplier for next interval. -|spring.cloud.config.send-state | `true` | Flag to indicate whether to send state. Default true. -|spring.cloud.config.tls | | TLS properties. +|spring.cloud.config.profile | default | The default profile to use when fetching remote configuration (comma-separated). Default is "default". +|spring.cloud.config.request-connect-timeout | 0 | timeout on waiting to connect to the Config Server. +|spring.cloud.config.request-read-timeout | 0 | timeout on waiting to read data from the Config Server. +|spring.cloud.config.retry.initial-interval | 1000 | Initial retry interval in milliseconds. +|spring.cloud.config.retry.max-attempts | 6 | Maximum number of attempts. +|spring.cloud.config.retry.max-interval | 2000 | Maximum interval for backoff. +|spring.cloud.config.retry.multiplier | 1.1 | Multiplier for next interval. +|spring.cloud.config.send-state | true | Flag to indicate whether to send state. Default true. |spring.cloud.config.token | | Security Token passed thru to underlying environment repository. -|spring.cloud.config.uri | `[http://localhost:8888]` | The URI of the remote server (default http://localhost:8888). +|spring.cloud.config.uri | [http://localhost:8888] | The URI of the remote server (default http://localhost:8888). |spring.cloud.config.username | | The username to use (HTTP Basic) when contacting the remote server. |=== \ No newline at end of file diff --git a/pom.xml b/pom.xml index c3ccc6fe..635c2d4f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.springframework.cloud spring-cloud-config - 2.2.7.RELEASE + 2.2.7.BUILD-SNAPSHOT pom Spring Cloud Config Spring Cloud Config @@ -13,7 +13,7 @@ org.springframework.cloud spring-cloud-build - 2.3.2.RELEASE + 2.3.1.RELEASE @@ -27,7 +27,7 @@ config - 2.2.7.RELEASE + 2.2.7.BUILD-SNAPSHOT 1.11.52 v1-rev20191010-1.30.3 true diff --git a/spring-cloud-config-client-tls-tests/pom.xml b/spring-cloud-config-client-tls-tests/pom.xml index 7b0fcdd8..e3f65420 100644 --- a/spring-cloud-config-client-tls-tests/pom.xml +++ b/spring-cloud-config-client-tls-tests/pom.xml @@ -10,7 +10,7 @@ org.springframework.cloud spring-cloud-config - 2.2.7.RELEASE + 2.2.7.BUILD-SNAPSHOT .. diff --git a/spring-cloud-config-client/pom.xml b/spring-cloud-config-client/pom.xml index 60069d28..6814034f 100644 --- a/spring-cloud-config-client/pom.xml +++ b/spring-cloud-config-client/pom.xml @@ -10,7 +10,7 @@ org.springframework.cloud spring-cloud-config - 2.2.7.RELEASE + 2.2.7.BUILD-SNAPSHOT .. diff --git a/spring-cloud-config-dependencies/pom.xml b/spring-cloud-config-dependencies/pom.xml index 809fac3e..370adf47 100644 --- a/spring-cloud-config-dependencies/pom.xml +++ b/spring-cloud-config-dependencies/pom.xml @@ -6,11 +6,11 @@ spring-cloud-dependencies-parent org.springframework.cloud - 2.3.2.RELEASE + 2.3.2.BUILD-SNAPSHOT spring-cloud-config-dependencies - 2.2.7.RELEASE + 2.2.7.BUILD-SNAPSHOT pom spring-cloud-config-dependencies Spring Cloud Config Dependencies diff --git a/spring-cloud-config-monitor/pom.xml b/spring-cloud-config-monitor/pom.xml index 6b311902..9690933c 100644 --- a/spring-cloud-config-monitor/pom.xml +++ b/spring-cloud-config-monitor/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-config - 2.2.7.RELEASE + 2.2.7.BUILD-SNAPSHOT .. spring-cloud-config-monitor diff --git a/spring-cloud-config-sample/pom.xml b/spring-cloud-config-sample/pom.xml index c1ff38ab..1e802f4a 100644 --- a/spring-cloud-config-sample/pom.xml +++ b/spring-cloud-config-sample/pom.xml @@ -13,7 +13,7 @@ org.springframework.cloud spring-cloud-config - 2.2.7.RELEASE + 2.2.7.BUILD-SNAPSHOT .. diff --git a/spring-cloud-config-server/pom.xml b/spring-cloud-config-server/pom.xml index da96146b..c174798a 100644 --- a/spring-cloud-config-server/pom.xml +++ b/spring-cloud-config-server/pom.xml @@ -13,7 +13,7 @@ org.springframework.cloud spring-cloud-config - 2.2.7.RELEASE + 2.2.7.BUILD-SNAPSHOT .. diff --git a/spring-cloud-starter-config/pom.xml b/spring-cloud-starter-config/pom.xml index 9eaf900e..6f6d4626 100644 --- a/spring-cloud-starter-config/pom.xml +++ b/spring-cloud-starter-config/pom.xml @@ -6,10 +6,10 @@ org.springframework.cloud spring-cloud-config - 2.2.7.RELEASE + 2.2.7.BUILD-SNAPSHOT spring-cloud-starter-config - 2.2.7.RELEASE + 2.2.7.BUILD-SNAPSHOT spring-cloud-starter-config Spring Cloud Starter https://projects.spring.io/spring-cloud From 55bba36e2f6cc638215df9ae8e0df9fe68f648e2 Mon Sep 17 00:00:00 2001 From: buildmaster Date: Thu, 11 Feb 2021 13:53:29 +0000 Subject: [PATCH 4/7] Bumping versions to 2.2.8.BUILD-SNAPSHOT after release --- docs/pom.xml | 2 +- pom.xml | 6 +++--- spring-cloud-config-client-tls-tests/pom.xml | 2 +- spring-cloud-config-client/pom.xml | 2 +- spring-cloud-config-dependencies/pom.xml | 4 ++-- spring-cloud-config-monitor/pom.xml | 2 +- spring-cloud-config-sample/pom.xml | 2 +- spring-cloud-config-server/pom.xml | 2 +- spring-cloud-starter-config/pom.xml | 4 ++-- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/pom.xml b/docs/pom.xml index 2d73da69..daeb6be6 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -8,7 +8,7 @@ org.springframework.cloud spring-cloud-config - 2.2.7.BUILD-SNAPSHOT + 2.2.8.BUILD-SNAPSHOT .. diff --git a/pom.xml b/pom.xml index 635c2d4f..cca7f673 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.springframework.cloud spring-cloud-config - 2.2.7.BUILD-SNAPSHOT + 2.2.8.BUILD-SNAPSHOT pom Spring Cloud Config Spring Cloud Config @@ -13,7 +13,7 @@ org.springframework.cloud spring-cloud-build - 2.3.1.RELEASE + 2.3.2.RELEASE @@ -27,7 +27,7 @@ config - 2.2.7.BUILD-SNAPSHOT + 2.2.8.BUILD-SNAPSHOT 1.11.52 v1-rev20191010-1.30.3 true diff --git a/spring-cloud-config-client-tls-tests/pom.xml b/spring-cloud-config-client-tls-tests/pom.xml index e3f65420..72e48672 100644 --- a/spring-cloud-config-client-tls-tests/pom.xml +++ b/spring-cloud-config-client-tls-tests/pom.xml @@ -10,7 +10,7 @@ org.springframework.cloud spring-cloud-config - 2.2.7.BUILD-SNAPSHOT + 2.2.8.BUILD-SNAPSHOT .. diff --git a/spring-cloud-config-client/pom.xml b/spring-cloud-config-client/pom.xml index 6814034f..40f69a6b 100644 --- a/spring-cloud-config-client/pom.xml +++ b/spring-cloud-config-client/pom.xml @@ -10,7 +10,7 @@ org.springframework.cloud spring-cloud-config - 2.2.7.BUILD-SNAPSHOT + 2.2.8.BUILD-SNAPSHOT .. diff --git a/spring-cloud-config-dependencies/pom.xml b/spring-cloud-config-dependencies/pom.xml index 370adf47..905db5bb 100644 --- a/spring-cloud-config-dependencies/pom.xml +++ b/spring-cloud-config-dependencies/pom.xml @@ -6,11 +6,11 @@ spring-cloud-dependencies-parent org.springframework.cloud - 2.3.2.BUILD-SNAPSHOT + 2.3.3.BUILD-SNAPSHOT spring-cloud-config-dependencies - 2.2.7.BUILD-SNAPSHOT + 2.2.8.BUILD-SNAPSHOT pom spring-cloud-config-dependencies Spring Cloud Config Dependencies diff --git a/spring-cloud-config-monitor/pom.xml b/spring-cloud-config-monitor/pom.xml index 9690933c..cdf3589a 100644 --- a/spring-cloud-config-monitor/pom.xml +++ b/spring-cloud-config-monitor/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-config - 2.2.7.BUILD-SNAPSHOT + 2.2.8.BUILD-SNAPSHOT .. spring-cloud-config-monitor diff --git a/spring-cloud-config-sample/pom.xml b/spring-cloud-config-sample/pom.xml index 1e802f4a..b9e0cda0 100644 --- a/spring-cloud-config-sample/pom.xml +++ b/spring-cloud-config-sample/pom.xml @@ -13,7 +13,7 @@ org.springframework.cloud spring-cloud-config - 2.2.7.BUILD-SNAPSHOT + 2.2.8.BUILD-SNAPSHOT .. diff --git a/spring-cloud-config-server/pom.xml b/spring-cloud-config-server/pom.xml index c174798a..6d8be3ac 100644 --- a/spring-cloud-config-server/pom.xml +++ b/spring-cloud-config-server/pom.xml @@ -13,7 +13,7 @@ org.springframework.cloud spring-cloud-config - 2.2.7.BUILD-SNAPSHOT + 2.2.8.BUILD-SNAPSHOT .. diff --git a/spring-cloud-starter-config/pom.xml b/spring-cloud-starter-config/pom.xml index 6f6d4626..6b590070 100644 --- a/spring-cloud-starter-config/pom.xml +++ b/spring-cloud-starter-config/pom.xml @@ -6,10 +6,10 @@ org.springframework.cloud spring-cloud-config - 2.2.7.BUILD-SNAPSHOT + 2.2.8.BUILD-SNAPSHOT spring-cloud-starter-config - 2.2.7.BUILD-SNAPSHOT + 2.2.8.BUILD-SNAPSHOT spring-cloud-starter-config Spring Cloud Starter https://projects.spring.io/spring-cloud From e7be2b8c5a0203fc58d8740cb11fac44c62ef5ba Mon Sep 17 00:00:00 2001 From: spencergibb Date: Mon, 29 Mar 2021 16:25:33 -0400 Subject: [PATCH 5/7] Register env repo properties as beans. The `CompositeEnvironmentBeanFactoryPostProcessor` binds the required properties for a EnvironmentRepositoryFactory, but does not register it as a bean. This is now done with a supplier to the bound instance. Fixes gh-1720 --- .../test/java/sample/ApplicationBootstrapTests.java | 9 +++++++++ .../CompositeEnvironmentBeanFactoryPostProcessor.java | 11 ++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/spring-cloud-config-sample/src/test/java/sample/ApplicationBootstrapTests.java b/spring-cloud-config-sample/src/test/java/sample/ApplicationBootstrapTests.java index 34d2bbb2..6f24efca 100644 --- a/spring-cloud-config-sample/src/test/java/sample/ApplicationBootstrapTests.java +++ b/spring-cloud-config-sample/src/test/java/sample/ApplicationBootstrapTests.java @@ -29,6 +29,7 @@ import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointPr import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentProperties; import org.springframework.cloud.config.server.test.ConfigServerTestUtils; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.test.context.junit4.SpringRunner; @@ -107,4 +108,12 @@ public class ApplicationBootstrapTests { assertThat(property).containsEntry("value", "bar"); } + @Test + public void propertiesBeansRegisterByCompositeEnvBeanFactoryPostProcessor() { + String[] beanNames = server + .getBeanNamesForType(MultipleJGitEnvironmentProperties.class); + assertThat(beanNames).isNotNull() + .anyMatch(s -> s.matches("git-env-repo-properties\\d")); + } + } diff --git a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/composite/CompositeEnvironmentBeanFactoryPostProcessor.java b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/composite/CompositeEnvironmentBeanFactoryPostProcessor.java index 0cf497af..d52027e3 100644 --- a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/composite/CompositeEnvironmentBeanFactoryPostProcessor.java +++ b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/composite/CompositeEnvironmentBeanFactoryPostProcessor.java @@ -46,9 +46,12 @@ public class CompositeEnvironmentBeanFactoryPostProcessor this.environment = environment; } + @SuppressWarnings("unchecked") @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { + BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory; + List typePropertyList = CompositeUtils .getCompositeTypeList(this.environment); for (int i = 0; i < typePropertyList.size(); i++) { @@ -61,13 +64,19 @@ public class CompositeEnvironmentBeanFactoryPostProcessor propertiesClass = (Class) factoryTypes[1]; EnvironmentRepositoryProperties properties = bindProperties(i, propertiesClass, this.environment); + AbstractBeanDefinition propertiesDefinition = BeanDefinitionBuilder + .genericBeanDefinition(EnvironmentRepositoryProperties.class, + () -> properties) + .getBeanDefinition(); + String propertiesBeanName = String.format("%s-env-repo-properties%d", type, + i); + registry.registerBeanDefinition(propertiesBeanName, propertiesDefinition); AbstractBeanDefinition beanDefinition = BeanDefinitionBuilder .genericBeanDefinition(EnvironmentRepository.class) .setFactoryMethodOnBean("build", factoryName) .addConstructorArgValue(properties).getBeanDefinition(); String beanName = String.format("%s-env-repo%d", type, i); - BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory; registry.registerBeanDefinition(beanName, beanDefinition); } } From 4fc9696060b8306c1a4a0ab7c1dae73d4eaf3151 Mon Sep 17 00:00:00 2001 From: Eugene Date: Sat, 20 Mar 2021 14:23:13 -0400 Subject: [PATCH 6/7] Updates case of property in documentation Fixes gh-1840 --- docs/src/main/asciidoc/spring-cloud-config.adoc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/src/main/asciidoc/spring-cloud-config.adoc b/docs/src/main/asciidoc/spring-cloud-config.adoc index 0de707b9..302cccd1 100644 --- a/docs/src/main/asciidoc/spring-cloud-config.adoc +++ b/docs/src/main/asciidoc/spring-cloud-config.adoc @@ -241,7 +241,7 @@ spring: NOTE: Spring Cloud guesses that a pattern containing a profile that does not end in `\*` implies that you actually want to match a list of profiles starting with this pattern (so `*/staging` is a shortcut for `["\*/staging", "*/staging,*"]`, and so on). This is common where, for instance, you need to run applications in the "`development`" profile locally but also the "`cloud`" profile remotely. -Every repository can also optionally store config files in sub-directories, and patterns to search for those directories can be specified as `searchPaths`. +Every repository can also optionally store config files in sub-directories, and patterns to search for those directories can be specified as `search-paths`. The following example shows a config file at the top level: [source,yaml] @@ -252,7 +252,9 @@ spring: server: git: uri: https://github.com/spring-cloud-samples/config-repo - searchPaths: foo,bar* + search-paths: + - foo + - bar* ---- In the preceding example, the server searches for config files in the top level and in the `foo/` sub-directory and also any sub-directory whose name begins with `bar`. @@ -448,7 +450,7 @@ spring: server: git: uri: https://github.com/spring-cloud-samples/config-repo - searchPaths: '{application}' + search-paths: '{application}' ---- The preceding listing causes a search of the repository for files in the same name as the directory (as well as the top level). From 962abe74622d9a1e3a507c7180a75a87c9117849 Mon Sep 17 00:00:00 2001 From: spencergibb Date: Mon, 29 Mar 2021 16:57:33 -0400 Subject: [PATCH 7/7] Makes actuator optional for config server. Fixes gh-1742 --- spring-cloud-config-server/pom.xml | 1 + .../EnvironmentRepositoryConfiguration.java | 23 +++++++++++------ .../server/CompositeClasspathTests.java | 25 +++++++++++++++++++ 3 files changed, 41 insertions(+), 8 deletions(-) diff --git a/spring-cloud-config-server/pom.xml b/spring-cloud-config-server/pom.xml index 6d8be3ac..637ff04a 100644 --- a/spring-cloud-config-server/pom.xml +++ b/spring-cloud-config-server/pom.xml @@ -40,6 +40,7 @@ org.springframework.boot spring-boot-starter-actuator + true org.springframework.boot diff --git a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/config/EnvironmentRepositoryConfiguration.java b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/config/EnvironmentRepositoryConfiguration.java index e6ff68a5..9904c855 100644 --- a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/config/EnvironmentRepositoryConfiguration.java +++ b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/config/EnvironmentRepositoryConfiguration.java @@ -27,6 +27,7 @@ import org.eclipse.jgit.api.TransportConfigCallback; import org.tmatesoft.svn.core.SVNException; import org.springframework.beans.factory.ObjectProvider; +import org.springframework.boot.actuate.health.AbstractHealthIndicator; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; @@ -110,14 +111,6 @@ import org.springframework.vault.core.VaultTemplate; AwsS3RepositoryConfiguration.class, DefaultRepositoryConfiguration.class }) public class EnvironmentRepositoryConfiguration { - @Bean - @ConditionalOnProperty(value = "spring.cloud.config.server.health.enabled", - matchIfMissing = true) - public ConfigServerHealthIndicator configServerHealthIndicator( - EnvironmentRepository repository) { - return new ConfigServerHealthIndicator(repository); - } - @Bean @ConditionalOnMissingBean(search = SearchStrategy.CURRENT) public MultipleJGitEnvironmentProperties multipleJGitEnvironmentProperties() { @@ -131,6 +124,20 @@ public class EnvironmentRepositoryConfiguration { return new HttpRequestConfigTokenProvider(httpRequest); } + @Configuration(proxyBeanMethods = false) + @ConditionalOnClass(AbstractHealthIndicator.class) + @ConditionalOnProperty(value = "spring.cloud.config.server.health.enabled", + matchIfMissing = true) + protected static class ConfigServerActuatorConfiguration { + + @Bean + public ConfigServerHealthIndicator configServerHealthIndicator( + EnvironmentRepository repository) { + return new ConfigServerHealthIndicator(repository); + } + + } + @Configuration(proxyBeanMethods = false) @ConditionalOnProperty("spring.cloud.config.server.consul.watch.enabled") protected static class ConsulEnvironmentWatchConfiguration { diff --git a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/CompositeClasspathTests.java b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/CompositeClasspathTests.java index a033faf8..99028913 100644 --- a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/CompositeClasspathTests.java +++ b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/CompositeClasspathTests.java @@ -24,6 +24,8 @@ import org.springframework.cloud.config.server.composite.CompositeUtils; import org.springframework.cloud.test.ClassPathExclusions; import org.springframework.cloud.test.ModifiedClassPathRunner; +import static org.assertj.core.api.Assertions.assertThat; + public class CompositeClasspathTests { @RunWith(ModifiedClassPathRunner.class) @@ -48,6 +50,29 @@ public class CompositeClasspathTests { } + @RunWith(ModifiedClassPathRunner.class) + @ClassPathExclusions({ "spring-jdbc-*.jar", "spring-data-redis-*.jar", + "spring-boot-actuator-*.jar" }) + public static class NoActuatorTests { + + @Test + public void contextLoads() { + new WebApplicationContextRunner() + .withUserConfiguration(ConfigServerApplication.class) + .withPropertyValues("spring.profiles.active:test,composite", + "spring.jmx.enabled=false", + "spring.config.name:compositeconfigserver", + "spring.cloud.config.server.composite[0].uri:file:./target/repos/config-repo", + "spring.cloud.config.server.composite[0].type:git") + .run(context -> { + CompositeUtils.getCompositeTypeList(context.getEnvironment()); + assertThat(context) + .doesNotHaveBean("configServerHealthIndicator"); + }); + } + + } + @RunWith(ModifiedClassPathRunner.class) @ClassPathExclusions("httpclient-*.jar") public static class HttpClientTests {