Resolve placeholders in reference config against all other config

Fixes gh-34643
pull/34975/head
Andy Wilkinson 2 years ago
parent 0ed73a859b
commit c9e69b13b1

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

@ -300,6 +300,18 @@ class CassandraAutoConfigurationTests {
});
}
@Test
void placeholdersInReferenceConfAreResolvedAgainstConfigDerivedFromSpringCassandraProperties() {
this.contextRunner.withPropertyValues("spring.data.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