Merge branch '3.1.x' into 4.0.x

This commit is contained in:
Ryan Baxter
2023-06-27 19:40:33 -04:00
5 changed files with 15 additions and 5 deletions

View File

@@ -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.

View File

@@ -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]]

View File

@@ -166,7 +166,8 @@ public class ConfigServerConfigDataLoader implements ConfigDataLoader<ConfigServ
// , is used as a profile-separator for property sources
// from vault
// - is the default profile-separator for property sources
// TODO This is error prone logic see https://github.com/spring-cloud/spring-cloud-config/issues/2291
// TODO This is error prone logic see
// https://github.com/spring-cloud/spring-cloud-config/issues/2291
if (propertySourceName.matches(".*[-,]" + profile + ".*")) {
// // TODO: switch to Options.with() when implemented
options.add(Option.PROFILE_SPECIFIC);

View File

@@ -53,7 +53,7 @@ public class ConfigDataOrderingVaultIntegrationTests {
private static ConfigurableApplicationContext server;
@Container
public static VaultContainer vaultContainer = new VaultContainer<>(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);

View File

@@ -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) {