Skip to content

Commit bb0ec34

Browse files
committed
Resolve placeholders in reference config against all other config
Fixes gh-34643
1 parent 1aaf498 commit bb0ec34

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cassandra/CassandraAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ private Config cassandraConfiguration() {
149149
config = config.withFallback(loadConfig(this.properties.getConfig()));
150150
}
151151
config = config.withFallback(SPRING_BOOT_DEFAULTS);
152-
config = config.withFallback(ConfigFactory.defaultReference());
152+
config = config.withFallback(ConfigFactory.defaultReferenceUnresolved());
153153
return config.resolve();
154154
}
155155

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cassandra/CassandraAutoConfigurationTests.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,18 @@ void driverConfigLoaderWithConfigOverridesDefaults() {
322322
});
323323
}
324324

325+
@Test
326+
void placeholdersInReferenceConfAreResolvedAgainstConfigDerivedFromSpringCassandraProperties() {
327+
this.contextRunner.withPropertyValues("spring.cassandra.request.timeout=60s").run((context) -> {
328+
DriverExecutionProfile actual = context.getBean(DriverConfigLoader.class)
329+
.getInitialConfig()
330+
.getDefaultProfile();
331+
assertThat(actual.getDuration(DefaultDriverOption.REQUEST_TIMEOUT)).isEqualTo(Duration.ofSeconds(60));
332+
assertThat(actual.getDuration(DefaultDriverOption.METADATA_SCHEMA_REQUEST_TIMEOUT))
333+
.isEqualTo(Duration.ofSeconds(60));
334+
});
335+
}
336+
325337
@Test
326338
void driverConfigLoaderWithConfigCreateProfiles() {
327339
String configLocation = "org/springframework/boot/autoconfigure/cassandra/profiles.conf";

0 commit comments

Comments
 (0)