diff --git a/docs/src/main/asciidoc/_configprops.adoc b/docs/src/main/asciidoc/_configprops.adoc index c19776c0..5d4e8059 100644 --- a/docs/src/main/asciidoc/_configprops.adoc +++ b/docs/src/main/asciidoc/_configprops.adoc @@ -8,7 +8,7 @@ |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.initialize-on-context-refresh | `+++false+++` | Flag to initialize bootstrap configuration on context refresh event. Default false. -|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.label | | The label name to use to pull remote configuration properties. The default is set on the server (generally "main" for a git based server). |spring.cloud.config.media-type | | The Accept header media type to send to config server. |spring.cloud.config.multiple-uri-strategy | | The strategy to use when call to server fails and there are multiple URLs configured on the uri property (default {@link MultipleUriStrategy#ALWAYS}). |spring.cloud.config.name | | Name of application used to fetch remote properties. diff --git a/docs/src/main/asciidoc/spring-cloud-config.adoc b/docs/src/main/asciidoc/spring-cloud-config.adoc index 1f634393..af52458e 100644 --- a/docs/src/main/asciidoc/spring-cloud-config.adoc +++ b/docs/src/main/asciidoc/spring-cloud-config.adoc @@ -1833,6 +1833,15 @@ spring.config.import=optional:configserver: This will connect to the Config Server at the default location of "http://localhost:8888". Removing the `optional:` prefix will cause the Config Client to fail if it is unable to connect to Config Server. To change the location of Config Server either set `spring.cloud.config.uri` or add the url to the `spring.config.import` statement such as, `spring.config.import=optional:configserver:http://myhost:8888`. The location in the import property has precedence over the uri property. +Spring Boot Config Data resolves configuration in a two step process. First it loads all configuration using the `default` +profile. This allows Spring Boot to gather all configuration which may activate any additional profiles. +After it has gathered all activated profiles it will load any additional configuration for the active profiles. +Due to this you may see multiple requests being made to the Spring Cloud Config Server to fetch configuration. This +is normal and is a side effect of how Spring Boot loads configuration when using `spring.config.import`. In previous +versions of Spring Cloud Config there was only a single request made but this meant you could not activate profiles +from configuration coming from the Config Server. The additional request with just the 'default` profile now makes +this possible. + NOTE: A `bootstrap` file (properties or yaml) is *not* needed for the Spring Boot Config Data method of import via `spring.config.import`. [[config-first-bootstrap]] diff --git a/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/client/ConfigServerConfigDataLoader.java b/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/client/ConfigServerConfigDataLoader.java index c2703428..ced0f6ef 100644 --- a/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/client/ConfigServerConfigDataLoader.java +++ b/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/client/ConfigServerConfigDataLoader.java @@ -166,7 +166,8 @@ public class ConfigServerConfigDataLoader implements ConfigDataLoader(DockerImageName.parse("vault")) + public static VaultContainer vaultContainer = new VaultContainer<>(DockerImageName.parse("vault:1.13.3")) .withVaultToken("my-root-token").withClasspathResourceMapping("vaultordering/vault_test_policy.txt", "/tmp/vault_test_policy.txt", BindMode.READ_ONLY); diff --git a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/support/HttpClient4SupportTest.java b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/support/HttpClient4SupportTest.java index 64a3e2d7..6f0e6b06 100644 --- a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/support/HttpClient4SupportTest.java +++ b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/support/HttpClient4SupportTest.java @@ -71,7 +71,7 @@ public class HttpClient4SupportTest { @EnabledOnJre(JRE.JAVA_8) public void httpsProxy() throws GeneralSecurityException, IOException { WireMockServer wireMockProxyServer = new WireMockServer( - options().httpDisabled(true).dynamicHttpsPort().enableBrowserProxying(true).trustAllProxyTargets(true)); + options().httpDisabled(true).dynamicHttpsPort().enableBrowserProxying(true).trustAllProxyTargets(true)); WireMockServer wireMockServer = new WireMockServer(options().httpDisabled(true).dynamicHttpsPort()); wireMockProxyServer.start(); wireMockServer.start(); @@ -91,7 +91,7 @@ public class HttpClient4SupportTest { try { httpClient = HttpClient4Support.builder(properties).build(); response = httpClient - .execute(new HttpGet("https://localhost:" + wireMockServer.httpsPort() + "/test/proxy")); + .execute(new HttpGet("https://localhost:" + wireMockServer.httpsPort() + "/test/proxy")); } finally { if (response != null) {