Skip to content

Commit

Permalink
Resolve placeholders in reference config against all other config
Browse files Browse the repository at this point in the history
Fixes gh-34643
  • Loading branch information
wilkinsona committed Mar 28, 2023
1 parent 0ed73a8 commit c9e69b1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private Config cassandraConfiguration(CassandraProperties properties) {
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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,18 @@ void driverConfigLoaderWithConfigOverridesDefaults() {
});
}

@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";
Expand Down

0 comments on commit c9e69b1

Please sign in to comment.