Resolve placeholders in reference config against all other config

Fixes gh-34643
pull/34804/head
Andy Wilkinson 2 years ago
parent 1aaf498bb9
commit bb0ec34e7b

@ -149,7 +149,7 @@ public class CassandraAutoConfiguration {
config = config.withFallback(loadConfig(this.properties.getConfig()));
}
config = config.withFallback(SPRING_BOOT_DEFAULTS);
config = config.withFallback(ConfigFactory.defaultReference());
config = config.withFallback(ConfigFactory.defaultReferenceUnresolved());
return config.resolve();
}

@ -322,6 +322,18 @@ class CassandraAutoConfigurationTests {
});
}
@Test
void placeholdersInReferenceConfAreResolvedAgainstConfigDerivedFromSpringCassandraProperties() {
this.contextRunner.withPropertyValues("spring.cassandra.request.timeout=60s").run((context) -> {
DriverExecutionProfile actual = context.getBean(DriverConfigLoader.class)
.getInitialConfig()
.getDefaultProfile();
assertThat(actual.getDuration(DefaultDriverOption.REQUEST_TIMEOUT)).isEqualTo(Duration.ofSeconds(60));
assertThat(actual.getDuration(DefaultDriverOption.METADATA_SCHEMA_REQUEST_TIMEOUT))
.isEqualTo(Duration.ofSeconds(60));
});
}
@Test
void driverConfigLoaderWithConfigCreateProfiles() {
String configLocation = "org/springframework/boot/autoconfigure/cassandra/profiles.conf";

Loading…
Cancel
Save