diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cassandra/CassandraAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cassandra/CassandraAutoConfiguration.java index 580ce8a5e352..9a6d90b9e90f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cassandra/CassandraAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cassandra/CassandraAutoConfiguration.java @@ -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(); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cassandra/CassandraAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cassandra/CassandraAutoConfigurationTests.java index ebb87e8b2581..a94395cfeaf6 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cassandra/CassandraAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cassandra/CassandraAutoConfigurationTests.java @@ -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";