Harmonize data configuration

Any classes that rely on Spring Data being on the classpath
have been moved under a data package.

Certain configuration properties have also been updated to
accurately reflect whether Spring Data is required for the
auto-configuration to work.

Closes gh-11574
pull/31997/head
Madhura Bhave 3 years ago
parent 1af5994d8f
commit 0991bd3983

@ -125,13 +125,13 @@ public class DocumentConfigurationProperties extends DefaultTask {
private void dataPrefixes(Config config) { private void dataPrefixes(Config config) {
config.accept("spring.couchbase"); config.accept("spring.couchbase");
config.accept("spring.cassandra");
config.accept("spring.elasticsearch"); config.accept("spring.elasticsearch");
config.accept("spring.h2"); config.accept("spring.h2");
config.accept("spring.influx"); config.accept("spring.influx");
config.accept("spring.ldap"); config.accept("spring.ldap");
config.accept("spring.mongodb"); config.accept("spring.mongodb");
config.accept("spring.neo4j"); config.accept("spring.neo4j");
config.accept("spring.redis");
config.accept("spring.dao"); config.accept("spring.dao");
config.accept("spring.data"); config.accept("spring.data");
config.accept("spring.datasource"); config.accept("spring.datasource");

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.actuate.autoconfigure.elasticsearch; package org.springframework.boot.actuate.autoconfigure.data.elasticsearch;
import java.util.Map; import java.util.Map;
@ -22,7 +22,7 @@ import reactor.core.publisher.Flux;
import org.springframework.boot.actuate.autoconfigure.health.CompositeReactiveHealthContributorConfiguration; import org.springframework.boot.actuate.autoconfigure.health.CompositeReactiveHealthContributorConfiguration;
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator; import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
import org.springframework.boot.actuate.elasticsearch.ElasticsearchReactiveHealthIndicator; import org.springframework.boot.actuate.data.elasticsearch.ElasticsearchReactiveHealthIndicator;
import org.springframework.boot.actuate.health.ReactiveHealthContributor; import org.springframework.boot.actuate.health.ReactiveHealthContributor;
import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;

@ -0,0 +1,20 @@
/*
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Auto-configuration for actuator Elasticsearch concerns dependent on Spring Data.
*/
package org.springframework.boot.actuate.autoconfigure.data.elasticsearch;

@ -14,14 +14,14 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.actuate.autoconfigure.mongo; package org.springframework.boot.actuate.autoconfigure.data.mongo;
import java.util.Map; import java.util.Map;
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration; import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator; import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
import org.springframework.boot.actuate.data.mongo.MongoHealthIndicator;
import org.springframework.boot.actuate.health.HealthContributor; import org.springframework.boot.actuate.health.HealthContributor;
import org.springframework.boot.actuate.mongo.MongoHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.actuate.autoconfigure.mongo; package org.springframework.boot.actuate.autoconfigure.data.mongo;
import java.util.Map; import java.util.Map;
@ -22,8 +22,8 @@ import reactor.core.publisher.Flux;
import org.springframework.boot.actuate.autoconfigure.health.CompositeReactiveHealthContributorConfiguration; import org.springframework.boot.actuate.autoconfigure.health.CompositeReactiveHealthContributorConfiguration;
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator; import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
import org.springframework.boot.actuate.data.mongo.MongoReactiveHealthIndicator;
import org.springframework.boot.actuate.health.ReactiveHealthContributor; import org.springframework.boot.actuate.health.ReactiveHealthContributor;
import org.springframework.boot.actuate.mongo.MongoReactiveHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;

@ -15,6 +15,6 @@
*/ */
/** /**
* Actuator support for Mongo. * Auto-configuration for actuator MongoDB concerns dependent on Spring Data.
*/ */
package org.springframework.boot.actuate.mongo; package org.springframework.boot.actuate.autoconfigure.data.mongo;

@ -0,0 +1,20 @@
/*
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Auto-configuration for actuator concerns dependent on Spring Data.
*/
package org.springframework.boot.actuate.autoconfigure.data;

@ -14,14 +14,14 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.actuate.autoconfigure.redis; package org.springframework.boot.actuate.autoconfigure.data.redis;
import java.util.Map; import java.util.Map;
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration; import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator; import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
import org.springframework.boot.actuate.data.redis.RedisHealthIndicator;
import org.springframework.boot.actuate.health.HealthContributor; import org.springframework.boot.actuate.health.HealthContributor;
import org.springframework.boot.actuate.redis.RedisHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.actuate.autoconfigure.redis; package org.springframework.boot.actuate.autoconfigure.data.redis;
import java.util.Map; import java.util.Map;
@ -22,8 +22,8 @@ import reactor.core.publisher.Flux;
import org.springframework.boot.actuate.autoconfigure.health.CompositeReactiveHealthContributorConfiguration; import org.springframework.boot.actuate.autoconfigure.health.CompositeReactiveHealthContributorConfiguration;
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator; import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
import org.springframework.boot.actuate.data.redis.RedisReactiveHealthIndicator;
import org.springframework.boot.actuate.health.ReactiveHealthContributor; import org.springframework.boot.actuate.health.ReactiveHealthContributor;
import org.springframework.boot.actuate.redis.RedisReactiveHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;

@ -15,6 +15,6 @@
*/ */
/** /**
* Auto-configuration for actuator Redis concerns. * Auto-configuration for actuator Redis concerns dependent on Spring Data.
*/ */
package org.springframework.boot.actuate.autoconfigure.redis; package org.springframework.boot.actuate.autoconfigure.data.redis;

@ -14,7 +14,7 @@ org.springframework.boot.actuate.autoconfigure.context.properties.ConfigurationP
org.springframework.boot.actuate.autoconfigure.context.ShutdownEndpointAutoConfiguration org.springframework.boot.actuate.autoconfigure.context.ShutdownEndpointAutoConfiguration
org.springframework.boot.actuate.autoconfigure.couchbase.CouchbaseHealthContributorAutoConfiguration org.springframework.boot.actuate.autoconfigure.couchbase.CouchbaseHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.couchbase.CouchbaseReactiveHealthContributorAutoConfiguration org.springframework.boot.actuate.autoconfigure.couchbase.CouchbaseReactiveHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.elasticsearch.ElasticsearchReactiveHealthContributorAutoConfiguration org.springframework.boot.actuate.autoconfigure.data.elasticsearch.ElasticsearchReactiveHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.elasticsearch.ElasticsearchRestHealthContributorAutoConfiguration org.springframework.boot.actuate.autoconfigure.elasticsearch.ElasticsearchRestHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration
org.springframework.boot.actuate.autoconfigure.endpoint.jmx.JmxEndpointAutoConfiguration org.springframework.boot.actuate.autoconfigure.endpoint.jmx.JmxEndpointAutoConfiguration
@ -81,14 +81,14 @@ org.springframework.boot.actuate.autoconfigure.metrics.web.jetty.JettyMetricsAut
org.springframework.boot.actuate.autoconfigure.metrics.web.reactive.WebFluxMetricsAutoConfiguration org.springframework.boot.actuate.autoconfigure.metrics.web.reactive.WebFluxMetricsAutoConfiguration
org.springframework.boot.actuate.autoconfigure.metrics.web.servlet.WebMvcMetricsAutoConfiguration org.springframework.boot.actuate.autoconfigure.metrics.web.servlet.WebMvcMetricsAutoConfiguration
org.springframework.boot.actuate.autoconfigure.metrics.web.tomcat.TomcatMetricsAutoConfiguration org.springframework.boot.actuate.autoconfigure.metrics.web.tomcat.TomcatMetricsAutoConfiguration
org.springframework.boot.actuate.autoconfigure.mongo.MongoHealthContributorAutoConfiguration org.springframework.boot.actuate.autoconfigure.data.mongo.MongoHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.mongo.MongoReactiveHealthContributorAutoConfiguration org.springframework.boot.actuate.autoconfigure.data.mongo.MongoReactiveHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.neo4j.Neo4jHealthContributorAutoConfiguration org.springframework.boot.actuate.autoconfigure.neo4j.Neo4jHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.observation.ObservationAutoConfiguration org.springframework.boot.actuate.autoconfigure.observation.ObservationAutoConfiguration
org.springframework.boot.actuate.autoconfigure.quartz.QuartzEndpointAutoConfiguration org.springframework.boot.actuate.autoconfigure.quartz.QuartzEndpointAutoConfiguration
org.springframework.boot.actuate.autoconfigure.r2dbc.ConnectionFactoryHealthContributorAutoConfiguration org.springframework.boot.actuate.autoconfigure.r2dbc.ConnectionFactoryHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.redis.RedisHealthContributorAutoConfiguration org.springframework.boot.actuate.autoconfigure.data.redis.RedisHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.redis.RedisReactiveHealthContributorAutoConfiguration org.springframework.boot.actuate.autoconfigure.data.redis.RedisReactiveHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.scheduling.ScheduledTasksEndpointAutoConfiguration org.springframework.boot.actuate.autoconfigure.scheduling.ScheduledTasksEndpointAutoConfiguration
org.springframework.boot.actuate.autoconfigure.security.reactive.ReactiveManagementWebSecurityAutoConfiguration org.springframework.boot.actuate.autoconfigure.security.reactive.ReactiveManagementWebSecurityAutoConfiguration
org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration

@ -14,12 +14,13 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.actuate.autoconfigure.elasticsearch; package org.springframework.boot.actuate.autoconfigure.data.elasticsearch;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.autoconfigure.elasticsearch.ElasticsearchRestHealthContributorAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
import org.springframework.boot.actuate.elasticsearch.ElasticsearchReactiveHealthIndicator; import org.springframework.boot.actuate.data.elasticsearch.ElasticsearchReactiveHealthIndicator;
import org.springframework.boot.actuate.elasticsearch.ElasticsearchRestClientHealthIndicator; import org.springframework.boot.actuate.elasticsearch.ElasticsearchRestClientHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration; import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration;

@ -14,12 +14,12 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.actuate.autoconfigure.mongo; package org.springframework.boot.actuate.autoconfigure.data.mongo;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
import org.springframework.boot.actuate.mongo.MongoHealthIndicator; import org.springframework.boot.actuate.data.mongo.MongoHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration; import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration; import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;

@ -14,13 +14,13 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.actuate.autoconfigure.mongo; package org.springframework.boot.actuate.autoconfigure.data.mongo;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
import org.springframework.boot.actuate.mongo.MongoHealthIndicator; import org.springframework.boot.actuate.data.mongo.MongoHealthIndicator;
import org.springframework.boot.actuate.mongo.MongoReactiveHealthIndicator; import org.springframework.boot.actuate.data.mongo.MongoReactiveHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration; import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
import org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration; import org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration;

@ -14,13 +14,13 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.actuate.autoconfigure.redis; package org.springframework.boot.actuate.autoconfigure.data.redis;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
import org.springframework.boot.actuate.redis.RedisHealthIndicator; import org.springframework.boot.actuate.data.redis.RedisHealthIndicator;
import org.springframework.boot.actuate.redis.RedisReactiveHealthIndicator; import org.springframework.boot.actuate.data.redis.RedisReactiveHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.test.context.runner.ApplicationContextRunner;

@ -14,13 +14,13 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.actuate.autoconfigure.redis; package org.springframework.boot.actuate.autoconfigure.data.redis;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
import org.springframework.boot.actuate.redis.RedisHealthIndicator; import org.springframework.boot.actuate.data.redis.RedisHealthIndicator;
import org.springframework.boot.actuate.redis.RedisReactiveHealthIndicator; import org.springframework.boot.actuate.data.redis.RedisReactiveHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.test.context.runner.ApplicationContextRunner;

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.actuate.elasticsearch; package org.springframework.boot.actuate.data.elasticsearch;
import co.elastic.clients.elasticsearch._types.HealthStatus; import co.elastic.clients.elasticsearch._types.HealthStatus;
import co.elastic.clients.elasticsearch.cluster.HealthResponse; import co.elastic.clients.elasticsearch.cluster.HealthResponse;

@ -0,0 +1,20 @@
/*
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Actuator support for Elasticsearch dependent on Spring Data.
*/
package org.springframework.boot.actuate.data.elasticsearch;

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.actuate.mongo; package org.springframework.boot.actuate.data.mongo;
import org.bson.Document; import org.bson.Document;

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.actuate.mongo; package org.springframework.boot.actuate.data.mongo;
import org.bson.Document; import org.bson.Document;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -15,6 +15,6 @@
*/ */
/** /**
* Auto-configuration for actuator MongoDB concerns. * Actuator support for Mongo dependent on Spring Data.
*/ */
package org.springframework.boot.actuate.autoconfigure.mongo; package org.springframework.boot.actuate.data.mongo;

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -15,6 +15,6 @@
*/ */
/** /**
* Actuator support for Redis. * Actuator support dependent on Spring Data.
*/ */
package org.springframework.boot.actuate.redis; package org.springframework.boot.actuate.data;

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2021 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.actuate.redis; package org.springframework.boot.actuate.data.redis;
import java.util.Properties; import java.util.Properties;

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.actuate.redis; package org.springframework.boot.actuate.data.redis;
import org.springframework.boot.actuate.health.AbstractHealthIndicator; import org.springframework.boot.actuate.health.AbstractHealthIndicator;
import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.Health;

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.actuate.redis; package org.springframework.boot.actuate.data.redis;
import java.util.Properties; import java.util.Properties;

@ -0,0 +1,20 @@
/*
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Actuator support for Redis dependent on Spring Data.
*/
package org.springframework.boot.actuate.data.redis;

@ -30,6 +30,7 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.data.elasticsearch.ElasticsearchReactiveHealthIndicator;
import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.Status; import org.springframework.boot.actuate.health.Status;
import org.springframework.data.elasticsearch.client.elc.ReactiveElasticsearchClient; import org.springframework.data.elasticsearch.client.elc.ReactiveElasticsearchClient;

@ -49,7 +49,7 @@ class SanitizerTests {
assertThat(sanitizer.sanitize("token", "secret")).isEqualTo("******"); assertThat(sanitizer.sanitize("token", "secret")).isEqualTo("******");
assertThat(sanitizer.sanitize("sometoken", "secret")).isEqualTo("******"); assertThat(sanitizer.sanitize("sometoken", "secret")).isEqualTo("******");
assertThat(sanitizer.sanitize("find", "secret")).isEqualTo("secret"); assertThat(sanitizer.sanitize("find", "secret")).isEqualTo("secret");
assertThat(sanitizer.sanitize("sun.java.command", "--spring.redis.password=pa55w0rd")).isEqualTo("******"); assertThat(sanitizer.sanitize("sun.java.command", "--spring.data.redis.password=pa55w0rd")).isEqualTo("******");
assertThat(sanitizer.sanitize("SPRING_APPLICATION_JSON", "{password:123}")).isEqualTo("******"); assertThat(sanitizer.sanitize("SPRING_APPLICATION_JSON", "{password:123}")).isEqualTo("******");
assertThat(sanitizer.sanitize("spring.application.json", "{password:123}")).isEqualTo("******"); assertThat(sanitizer.sanitize("spring.application.json", "{password:123}")).isEqualTo("******");
assertThat(sanitizer.sanitize("VCAP_SERVICES", "{json}")).isEqualTo("******"); assertThat(sanitizer.sanitize("VCAP_SERVICES", "{json}")).isEqualTo("******");
@ -68,7 +68,7 @@ class SanitizerTests {
assertThat(sanitizer.sanitize("token", "secret")).isEqualTo("******"); assertThat(sanitizer.sanitize("token", "secret")).isEqualTo("******");
assertThat(sanitizer.sanitize("sometoken", "secret")).isEqualTo("******"); assertThat(sanitizer.sanitize("sometoken", "secret")).isEqualTo("******");
assertThat(sanitizer.sanitize("find", "secret")).isEqualTo("******"); assertThat(sanitizer.sanitize("find", "secret")).isEqualTo("******");
assertThat(sanitizer.sanitize("sun.java.command", "--spring.redis.password=pa55w0rd")).isEqualTo("******"); assertThat(sanitizer.sanitize("sun.java.command", "--spring.data.redis.password=pa55w0rd")).isEqualTo("******");
assertThat(sanitizer.sanitize("confidential", "secret")).isEqualTo("******"); assertThat(sanitizer.sanitize("confidential", "secret")).isEqualTo("******");
assertThat(sanitizer.sanitize("private", "secret")).isEqualTo("secret"); assertThat(sanitizer.sanitize("private", "secret")).isEqualTo("secret");
} }

@ -56,7 +56,7 @@ class RedisCacheMetricsTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class, CacheAutoConfiguration.class)) .withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class, CacheAutoConfiguration.class))
.withUserConfiguration(CachingConfiguration.class).withPropertyValues( .withUserConfiguration(CachingConfiguration.class).withPropertyValues(
"spring.redis.host=" + redis.getHost(), "spring.redis.port=" + redis.getFirstMappedPort(), "spring.data.redis.host=" + redis.getHost(), "spring.data.redis.port=" + redis.getFirstMappedPort(),
"spring.cache.type=redis", "spring.cache.redis.enable-statistics=true"); "spring.cache.type=redis", "spring.cache.redis.enable-statistics=true");
@Test @Test

@ -20,6 +20,7 @@ import com.mongodb.MongoException;
import org.bson.Document; import org.bson.Document;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.data.mongo.MongoHealthIndicator;
import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.Status; import org.springframework.boot.actuate.health.Status;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;

@ -22,6 +22,7 @@ import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
import reactor.test.StepVerifier; import reactor.test.StepVerifier;
import org.springframework.boot.actuate.data.mongo.MongoReactiveHealthIndicator;
import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.Status; import org.springframework.boot.actuate.health.Status;
import org.springframework.data.mongodb.core.ReactiveMongoTemplate; import org.springframework.data.mongodb.core.ReactiveMongoTemplate;

@ -22,6 +22,7 @@ import java.util.Properties;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.data.redis.RedisHealthIndicator;
import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.Status; import org.springframework.boot.actuate.health.Status;
import org.springframework.data.redis.RedisConnectionFailureException; import org.springframework.data.redis.RedisConnectionFailureException;

@ -23,6 +23,7 @@ import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
import reactor.test.StepVerifier; import reactor.test.StepVerifier;
import org.springframework.boot.actuate.data.redis.RedisReactiveHealthIndicator;
import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.Status; import org.springframework.boot.actuate.health.Status;
import org.springframework.data.redis.RedisConnectionFailureException; import org.springframework.data.redis.RedisConnectionFailureException;

@ -33,7 +33,7 @@ import org.springframework.core.io.Resource;
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 1.3.0 * @since 1.3.0
*/ */
@ConfigurationProperties(prefix = "spring.data.cassandra") @ConfigurationProperties(prefix = "spring.cassandra")
public class CassandraProperties { public class CassandraProperties {
/** /**

@ -108,7 +108,7 @@ public class CassandraDataAutoConfiguration {
session.setSession(this.session); session.setSession(this.session);
session.setConverter(converter); session.setConverter(converter);
Binder binder = Binder.get(environment); Binder binder = Binder.get(environment);
binder.bind("spring.data.cassandra.schema-action", SchemaAction.class).ifBound(session::setSchemaAction); binder.bind("spring.cassandra.schema-action", SchemaAction.class).ifBound(session::setSchemaAction);
return session; return session;
} }

@ -46,7 +46,7 @@ import org.springframework.util.StringUtils;
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ GenericObjectPool.class, JedisConnection.class, Jedis.class }) @ConditionalOnClass({ GenericObjectPool.class, JedisConnection.class, Jedis.class })
@ConditionalOnMissingBean(RedisConnectionFactory.class) @ConditionalOnMissingBean(RedisConnectionFactory.class)
@ConditionalOnProperty(name = "spring.redis.client-type", havingValue = "jedis", matchIfMissing = true) @ConditionalOnProperty(name = "spring.data.redis.client-type", havingValue = "jedis", matchIfMissing = true)
class JedisConnectionConfiguration extends RedisConnectionConfiguration { class JedisConnectionConfiguration extends RedisConnectionConfiguration {
JedisConnectionConfiguration(RedisProperties properties, JedisConnectionConfiguration(RedisProperties properties,

@ -55,7 +55,7 @@ import org.springframework.util.StringUtils;
*/ */
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnClass(RedisClient.class) @ConditionalOnClass(RedisClient.class)
@ConditionalOnProperty(name = "spring.redis.client-type", havingValue = "lettuce", matchIfMissing = true) @ConditionalOnProperty(name = "spring.data.redis.client-type", havingValue = "lettuce", matchIfMissing = true)
class LettuceConnectionConfiguration extends RedisConnectionConfiguration { class LettuceConnectionConfiguration extends RedisConnectionConfiguration {
LettuceConnectionConfiguration(RedisProperties properties, LettuceConnectionConfiguration(RedisProperties properties,

@ -32,7 +32,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 1.0.0 * @since 1.0.0
*/ */
@ConfigurationProperties(prefix = "spring.redis") @ConfigurationProperties(prefix = "spring.data.redis")
public class RedisProperties { public class RedisProperties {
/** /**

@ -36,12 +36,12 @@ class RedisUrlSyntaxFailureAnalyzer extends AbstractFailureAnalyzer<RedisUrlSynt
URI uri = new URI(cause.getUrl()); URI uri = new URI(cause.getUrl());
if ("redis-sentinel".equals(uri.getScheme())) { if ("redis-sentinel".equals(uri.getScheme())) {
return new FailureAnalysis(getUnsupportedSchemeDescription(cause.getUrl(), uri.getScheme()), return new FailureAnalysis(getUnsupportedSchemeDescription(cause.getUrl(), uri.getScheme()),
"Use spring.redis.sentinel properties instead of spring.redis.url to configure Redis sentinel addresses.", "Use spring.data.redis.sentinel properties instead of spring.data.redis.url to configure Redis sentinel addresses.",
cause); cause);
} }
if ("redis-socket".equals(uri.getScheme())) { if ("redis-socket".equals(uri.getScheme())) {
return new FailureAnalysis(getUnsupportedSchemeDescription(cause.getUrl(), uri.getScheme()), return new FailureAnalysis(getUnsupportedSchemeDescription(cause.getUrl(), uri.getScheme()),
"Configure the appropriate Spring Data Redis connection beans directly instead of setting the property 'spring.redis.url'.", "Configure the appropriate Spring Data Redis connection beans directly instead of setting the property 'spring.data.redis.url'.",
cause); cause);
} }
if (!"redis".equals(uri.getScheme()) && !"rediss".equals(uri.getScheme())) { if (!"redis".equals(uri.getScheme()) && !"rediss".equals(uri.getScheme())) {
@ -54,7 +54,7 @@ class RedisUrlSyntaxFailureAnalyzer extends AbstractFailureAnalyzer<RedisUrlSynt
// fall through to default description and action // fall through to default description and action
} }
return new FailureAnalysis(getDefaultDescription(cause.getUrl()), return new FailureAnalysis(getDefaultDescription(cause.getUrl()),
"Review the value of the property 'spring.redis.url'.", cause); "Review the value of the property 'spring.data.redis.url'.", cause);
} }
private String getDefaultDescription(String url) { private String getDefaultDescription(String url) {

@ -189,7 +189,6 @@
"description": "Class name of the servlet to use for JSPs. If registered is true and this class\n\t * is on the classpath then it will be registered.", "description": "Class name of the servlet to use for JSPs. If registered is true and this class\n\t * is on the classpath then it will be registered.",
"defaultValue": "org.apache.jasper.servlet.JspServlet" "defaultValue": "org.apache.jasper.servlet.JspServlet"
}, },
{ {
"name": "server.servlet.jsp.init-parameters", "name": "server.servlet.jsp.init-parameters",
"description": "Init parameters used to configure the JSP servlet." "description": "Init parameters used to configure the JSP servlet."
@ -497,6 +496,48 @@
"level": "error" "level": "error"
} }
}, },
{
"name": "spring.cassandra.compression",
"defaultValue": "none"
},
{
"name": "spring.cassandra.connection.connect-timeout",
"defaultValue": "5s"
},
{
"name": "spring.cassandra.connection.init-query-timeout",
"defaultValue": "5s"
},
{
"name": "spring.cassandra.contact-points",
"defaultValue": [
"127.0.0.1:9042"
]
},
{
"name": "spring.cassandra.controlconnection.timeout",
"defaultValue": "5s"
},
{
"name": "spring.cassandra.pool.heartbeat-interval",
"defaultValue": "30s"
},
{
"name": "spring.cassandra.pool.idle-timeout",
"defaultValue": "5s"
},
{
"name": "spring.cassandra.request.page-size",
"defaultValue": 5000
},
{
"name": "spring.cassandra.request.throttler.type",
"defaultValue": "none"
},
{
"name": "spring.cassandra.request.timeout",
"defaultValue": "2s"
},
{ {
"name": "spring.couchbase.bootstrap-hosts", "name": "spring.couchbase.bootstrap-hosts",
"type": "java.util.List<java.lang.String>", "type": "java.util.List<java.lang.String>",
@ -616,25 +657,53 @@
}, },
{ {
"name": "spring.data.cassandra.compression", "name": "spring.data.cassandra.compression",
"defaultValue": "none" "defaultValue": "none",
"deprecation": {
"replacement": "spring.cassandra.compression",
"level": "error"
}
},
{
"name": "spring.data.cassandra.config",
"type": "org.springframework.core.io.Resource",
"deprecation": {
"replacement": "spring.cassandra.config",
"level": "error"
}
}, },
{ {
"name": "spring.data.cassandra.connection.connect-timeout", "name": "spring.data.cassandra.connection.connect-timeout",
"defaultValue": "5s" "defaultValue": "5s",
"deprecation": {
"replacement": "spring.cassandra.connection.connect-timeout",
"level": "error"
}
}, },
{ {
"name": "spring.data.cassandra.connection.init-query-timeout", "name": "spring.data.cassandra.connection.init-query-timeout",
"defaultValue": "5s" "defaultValue": "5s",
"deprecation": {
"replacement": "spring.cassandra.connection.init-query-timeout",
"level": "error"
}
}, },
{ {
"name": "spring.data.cassandra.contact-points", "name": "spring.data.cassandra.contact-points",
"defaultValue": [ "defaultValue": [
"127.0.0.1:9042" "127.0.0.1:9042"
] ],
"deprecation": {
"replacement": "spring.cassandra.contact-points",
"level": "error"
}
}, },
{ {
"name": "spring.data.cassandra.controlconnection.timeout", "name": "spring.data.cassandra.controlconnection.timeout",
"defaultValue": "5s" "defaultValue": "5s",
"deprecation": {
"replacement": "spring.cassandra.controlconnection.timeout",
"level": "error"
}
}, },
{ {
"name": "spring.data.cassandra.jmx-enabled", "name": "spring.data.cassandra.jmx-enabled",
@ -645,6 +714,14 @@
"level": "error" "level": "error"
} }
}, },
{
"name": "spring.data.cassandra.keyspace-name",
"type": "java.lang.String",
"deprecation": {
"replacement": "spring.cassandra.keyspace-name",
"level": "error"
}
},
{ {
"name": "spring.data.cassandra.load-balancing-policy", "name": "spring.data.cassandra.load-balancing-policy",
"type": "java.lang.Class", "type": "java.lang.Class",
@ -653,19 +730,43 @@
"level": "error" "level": "error"
} }
}, },
{
"name": "spring.data.cassandra.local-datacenter",
"type": "java.lang.String",
"deprecation": {
"replacement": "spring.cassandra.local-datacenter",
"level": "error"
}
},
{
"name": "spring.data.cassandra.password",
"type": "java.lang.String",
"deprecation": {
"replacement": "spring.cassandra.password",
"level": "error"
}
},
{ {
"name": "spring.data.cassandra.pool.heartbeat-interval", "name": "spring.data.cassandra.pool.heartbeat-interval",
"defaultValue": "30s" "defaultValue": "30s",
"deprecation": {
"replacement": "spring.cassandra.pool.heartbeat-interval",
"level": "error"
}
}, },
{ {
"name": "spring.data.cassandra.pool.idle-timeout", "name": "spring.data.cassandra.pool.idle-timeout",
"defaultValue": "5s" "defaultValue": "5s",
"deprecation": {
"replacement": "spring.cassandra.pool.idle-timeout",
"level": "error"
}
}, },
{ {
"name": "spring.data.cassandra.pool.max-queue-size", "name": "spring.data.cassandra.pool.max-queue-size",
"type": "java.lang.Integer", "type": "java.lang.Integer",
"deprecation": { "deprecation": {
"replacement": "spring.data.cassandra.request.throttler.max-queue-size", "replacement": "spring.cassandra.request.throttler.max-queue-size",
"level": "error" "level": "error"
} }
}, },
@ -678,6 +779,14 @@
"level": "error" "level": "error"
} }
}, },
{
"name": "spring.data.cassandra.port",
"type": "java.lang.Integer",
"deprecation": {
"replacement": "spring.cassandra.port",
"level": "error"
}
},
{ {
"name": "spring.data.cassandra.reconnection-policy", "name": "spring.data.cassandra.reconnection-policy",
"type": "java.lang.Class", "type": "java.lang.Class",
@ -692,17 +801,77 @@
"description": "Type of Cassandra repositories to enable.", "description": "Type of Cassandra repositories to enable.",
"defaultValue": "auto" "defaultValue": "auto"
}, },
{
"name": "spring.data.cassandra.request.consistency",
"type": "com.datastax.oss.driver.api.core.DefaultConsistencyLevel",
"deprecation": {
"replacement": "spring.cassandra.request.consistency",
"level": "error"
}
},
{ {
"name": "spring.data.cassandra.request.page-size", "name": "spring.data.cassandra.request.page-size",
"defaultValue": 5000 "defaultValue": 5000,
"deprecation": {
"replacement": "spring.cassandra.request.page-size",
"level": "error"
}
},
{
"name": "spring.data.cassandra.request.serial-consistency",
"type": "com.datastax.oss.driver.api.core.DefaultConsistencyLevel",
"deprecation": {
"replacement": "spring.cassandra.request.serial-consistency",
"level": "error"
}
},
{
"name": "spring.data.cassandra.request.throttler.drain-interval",
"type": "java.time.Duration",
"deprecation": {
"replacement": "spring.cassandra.request.throttler.drain-interval",
"level": "error"
}
},
{
"name": "spring.data.cassandra.request.throttler.max-concurrent-requests",
"type": "java.lang.Integer",
"deprecation": {
"replacement": "spring.cassandra.request.throttler.max-concurrent-requests",
"level": "error"
}
},
{
"name": "spring.data.cassandra.request.throttler.max-queue-size",
"type": "java.lang.Integer",
"deprecation": {
"replacement": "spring.cassandra.request.throttler.max-queue-size",
"level": "error"
}
},
{
"name": "spring.data.cassandra.request.throttler.max-requests-per-second",
"type": "java.lang.Integer",
"deprecation": {
"replacement": "spring.cassandra.request.throttler.max-requests-per-second",
"level": "error"
}
}, },
{ {
"name": "spring.data.cassandra.request.throttler.type", "name": "spring.data.cassandra.request.throttler.type",
"defaultValue": "none" "defaultValue": "none",
"deprecation": {
"replacement": "spring.cassandra.request.throttler.type",
"level": "error"
}
}, },
{ {
"name": "spring.data.cassandra.request.timeout", "name": "spring.data.cassandra.request.timeout",
"defaultValue": "2s" "defaultValue": "2s",
"deprecation": {
"replacement": "spring.cassandra.request.timeout",
"level": "error"
}
}, },
{ {
"name": "spring.data.cassandra.retry-policy", "name": "spring.data.cassandra.retry-policy",
@ -712,6 +881,38 @@
"level": "error" "level": "error"
} }
}, },
{
"name": "spring.data.cassandra.schema-action",
"type": "java.lang.String",
"deprecation": {
"replacement": "spring.cassandra.schema-action",
"level": "error"
}
},
{
"name": "spring.data.cassandra.session-name",
"type": "java.lang.String",
"deprecation": {
"replacement": "spring.cassandra.session-name",
"level": "error"
}
},
{
"name": "spring.data.cassandra.ssl",
"type": "java.lang.Boolean",
"deprecation": {
"replacement": "spring.cassandra.ssl",
"level": "error"
}
},
{
"name": "spring.data.cassandra.username",
"type": "java.lang.String",
"deprecation": {
"replacement": "spring.cassandra.username",
"level": "error"
}
},
{ {
"name": "spring.data.couchbase.consistency", "name": "spring.data.couchbase.consistency",
"type": "org.springframework.data.couchbase.core.query.Consistency", "type": "org.springframework.data.couchbase.core.query.Consistency",
@ -1995,6 +2196,258 @@
"replacement": "spring.reactor.debug-agent.enabled" "replacement": "spring.reactor.debug-agent.enabled"
} }
}, },
{
"name": "spring.redis.client-name",
"type": "java.lang.String",
"deprecation": {
"replacement": "spring.data.redis.client-name",
"level": "error"
}
},
{
"name": "spring.redis.client-type",
"type": "org.springframework.boot.autoconfigure.data.redis.RedisProperties$ClientType",
"deprecation": {
"replacement": "spring.data.redis.client-type",
"level": "error"
}
},
{
"name": "spring.redis.cluster.max-redirects",
"type": "java.lang.Integer",
"deprecation": {
"replacement": "spring.data.redis.cluster.max-redirects",
"level": "error"
}
},
{
"name": "spring.redis.cluster.nodes",
"type": "java.util.List<java.lang.String>",
"deprecation": {
"replacement": "spring.data.redis.cluster.nodes",
"level": "error"
}
},
{
"name": "spring.redis.connect-timeout",
"type": "java.time.Duration",
"deprecation": {
"replacement": "spring.data.redis.connect-timeout",
"level": "error"
}
},
{
"name": "spring.redis.database",
"type": "java.lang.Integer",
"deprecation": {
"replacement": "spring.data.redis.database",
"level": "error"
}
},
{
"name": "spring.redis.host",
"type": "java.lang.String",
"deprecation": {
"replacement": "spring.data.redis.host",
"level": "error"
}
},
{
"name": "spring.redis.jedis.pool.enabled",
"type": "java.lang.Boolean",
"deprecation": {
"level": "error"
}
},
{
"name": "spring.redis.jedis.pool.max-active",
"type": "java.lang.Integer",
"deprecation": {
"level": "error"
}
},
{
"name": "spring.redis.jedis.pool.max-idle",
"type": "java.lang.Integer",
"deprecation": {
"level": "error"
}
},
{
"name": "spring.redis.jedis.pool.max-wait",
"type": "java.time.Duration",
"deprecation": {
"level": "error"
}
},
{
"name": "spring.redis.jedis.pool.min-idle",
"type": "java.lang.Integer",
"deprecation": {
"level": "error"
}
},
{
"name": "spring.redis.jedis.pool.time-between-eviction-runs",
"type": "java.time.Duration",
"deprecation": {
"level": "error"
}
},
{
"name": "spring.redis.lettuce.cluster.refresh.adaptive",
"type": "java.lang.Boolean",
"deprecation": {
"replacement": "spring.data.redis.lettuce.cluster.refresh.adaptive",
"level": "error"
}
},
{
"name": "spring.redis.lettuce.cluster.refresh.dynamic-refresh-sources",
"type": "java.lang.Boolean",
"deprecation": {
"replacement": "spring.data.redis.lettuce.cluster.refresh.dynamic-refresh-sources",
"level": "error"
}
},
{
"name": "spring.redis.lettuce.cluster.refresh.period",
"type": "java.time.Duration",
"deprecation": {
"replacement": "spring.data.redis.lettuce.cluster.refresh.period",
"level": "error"
}
},
{
"name": "spring.redis.lettuce.pool.enabled",
"type": "java.lang.Boolean",
"deprecation": {
"level": "error"
}
},
{
"name": "spring.redis.lettuce.pool.max-active",
"type": "java.lang.Integer",
"deprecation": {
"level": "error"
}
},
{
"name": "spring.redis.lettuce.pool.max-idle",
"type": "java.lang.Integer",
"deprecation": {
"level": "error"
}
},
{
"name": "spring.redis.lettuce.pool.max-wait",
"type": "java.time.Duration",
"deprecation": {
"level": "error"
}
},
{
"name": "spring.redis.lettuce.pool.min-idle",
"type": "java.lang.Integer",
"deprecation": {
"level": "error"
}
},
{
"name": "spring.redis.lettuce.pool.time-between-eviction-runs",
"type": "java.time.Duration",
"deprecation": {
"level": "error"
}
},
{
"name": "spring.redis.lettuce.shutdown-timeout",
"type": "java.time.Duration",
"deprecation": {
"replacement": "spring.data.redis.lettuce.shutdown-timeout",
"level": "error"
}
},
{
"name": "spring.redis.password",
"type": "java.lang.String",
"deprecation": {
"replacement": "spring.data.redis.password",
"level": "error"
}
},
{
"name": "spring.redis.port",
"type": "java.lang.Integer",
"deprecation": {
"replacement": "spring.data.redis.port",
"level": "error"
}
},
{
"name": "spring.redis.sentinel.master",
"type": "java.lang.String",
"deprecation": {
"replacement": "spring.data.redis.sentinel.master",
"level": "error"
}
},
{
"name": "spring.redis.sentinel.nodes",
"type": "java.util.List<java.lang.String>",
"deprecation": {
"replacement": "spring.data.redis.sentinel.nodes",
"level": "error"
}
},
{
"name": "spring.redis.sentinel.password",
"type": "java.lang.String",
"deprecation": {
"replacement": "spring.data.redis.sentinel.password",
"level": "error"
}
},
{
"name": "spring.redis.sentinel.username",
"type": "java.lang.String",
"deprecation": {
"replacement": "spring.data.redis.sentinel.username",
"level": "error"
}
},
{
"name": "spring.redis.ssl",
"type": "java.lang.Boolean",
"deprecation": {
"replacement": "spring.data.redis.ssl",
"level": "error"
}
},
{
"name": "spring.redis.timeout",
"type": "java.time.Duration",
"deprecation": {
"replacement": "spring.data.redis.timeout",
"level": "error"
}
},
{
"name": "spring.redis.url",
"type": "java.lang.String",
"deprecation": {
"replacement": "spring.data.redis.url",
"level": "error"
}
},
{
"name": "spring.redis.username",
"type": "java.lang.String",
"deprecation": {
"replacement": "spring.data.redis.username",
"level": "error"
}
},
{ {
"name": "spring.resources.add-mappings", "name": "spring.resources.add-mappings",
"type": "java.lang.Boolean", "type": "java.lang.Boolean",
@ -2509,7 +2962,7 @@
] ]
}, },
{ {
"name": "spring.data.cassandra.schema-action", "name": "spring.cassandra.schema-action",
"providers": [ "providers": [
{ {
"name": "handle-as", "name": "handle-as",

@ -47,12 +47,9 @@ class CassandraAutoConfigurationIntegrationTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(CassandraAutoConfiguration.class)).withPropertyValues( .withConfiguration(AutoConfigurations.of(CassandraAutoConfiguration.class)).withPropertyValues(
"spring.data.cassandra.contact-points:" + cassandra.getHost() + ":" "spring.cassandra.contact-points:" + cassandra.getHost() + ":" + cassandra.getFirstMappedPort(),
+ cassandra.getFirstMappedPort(), "spring.cassandra.local-datacenter=datacenter1", "spring.cassandra.connection.connect-timeout=60s",
"spring.data.cassandra.local-datacenter=datacenter1", "spring.cassandra.connection.init-query-timeout=60s", "spring.cassandra.request.timeout=60s");
"spring.data.cassandra.connection.connect-timeout=60s",
"spring.data.cassandra.connection.init-query-timeout=60s",
"spring.data.cassandra.request.timeout=60s");
@Test @Test
void whenTheContextIsClosedThenTheDriverConfigLoaderIsClosed() { void whenTheContextIsClosedThenTheDriverConfigLoaderIsClosed() {

@ -73,8 +73,8 @@ class CassandraAutoConfigurationTests {
@Test @Test
void driverConfigLoaderWithContactPoints() { void driverConfigLoaderWithContactPoints() {
this.contextRunner.withPropertyValues("spring.data.cassandra.contact-points=cluster.example.com:9042", this.contextRunner.withPropertyValues("spring.cassandra.contact-points=cluster.example.com:9042",
"spring.data.cassandra.local-datacenter=cassandra-eu1").run((context) -> { "spring.cassandra.local-datacenter=cassandra-eu1").run((context) -> {
assertThat(context).hasSingleBean(DriverConfigLoader.class); assertThat(context).hasSingleBean(DriverConfigLoader.class);
DriverExecutionProfile configuration = context.getBean(DriverConfigLoader.class).getInitialConfig() DriverExecutionProfile configuration = context.getBean(DriverConfigLoader.class).getInitialConfig()
.getDefaultProfile(); .getDefaultProfile();
@ -88,8 +88,8 @@ class CassandraAutoConfigurationTests {
@Test @Test
void driverConfigLoaderWithContactPointAndNoPort() { void driverConfigLoaderWithContactPointAndNoPort() {
this.contextRunner this.contextRunner
.withPropertyValues("spring.data.cassandra.contact-points=cluster.example.com,another.example.com:9041", .withPropertyValues("spring.cassandra.contact-points=cluster.example.com,another.example.com:9041",
"spring.data.cassandra.local-datacenter=cassandra-eu1") "spring.cassandra.local-datacenter=cassandra-eu1")
.run((context) -> { .run((context) -> {
assertThat(context).hasSingleBean(DriverConfigLoader.class); assertThat(context).hasSingleBean(DriverConfigLoader.class);
DriverExecutionProfile configuration = context.getBean(DriverConfigLoader.class).getInitialConfig() DriverExecutionProfile configuration = context.getBean(DriverConfigLoader.class).getInitialConfig()
@ -104,8 +104,8 @@ class CassandraAutoConfigurationTests {
@Test @Test
void driverConfigLoaderWithContactPointAndNoPortAndCustomPort() { void driverConfigLoaderWithContactPointAndNoPortAndCustomPort() {
this.contextRunner this.contextRunner
.withPropertyValues("spring.data.cassandra.contact-points=cluster.example.com:9041,another.example.com", .withPropertyValues("spring.cassandra.contact-points=cluster.example.com:9041,another.example.com",
"spring.data.cassandra.port=9043", "spring.data.cassandra.local-datacenter=cassandra-eu1") "spring.cassandra.port=9043", "spring.cassandra.local-datacenter=cassandra-eu1")
.run((context) -> { .run((context) -> {
assertThat(context).hasSingleBean(DriverConfigLoader.class); assertThat(context).hasSingleBean(DriverConfigLoader.class);
DriverExecutionProfile configuration = context.getBean(DriverConfigLoader.class).getInitialConfig() DriverExecutionProfile configuration = context.getBean(DriverConfigLoader.class).getInitialConfig()
@ -119,7 +119,7 @@ class CassandraAutoConfigurationTests {
@Test @Test
void driverConfigLoaderWithCustomSessionName() { void driverConfigLoaderWithCustomSessionName() {
this.contextRunner.withPropertyValues("spring.data.cassandra.session-name=testcluster").run((context) -> { this.contextRunner.withPropertyValues("spring.cassandra.session-name=testcluster").run((context) -> {
assertThat(context).hasSingleBean(DriverConfigLoader.class); assertThat(context).hasSingleBean(DriverConfigLoader.class);
assertThat(context.getBean(DriverConfigLoader.class).getInitialConfig().getDefaultProfile() assertThat(context.getBean(DriverConfigLoader.class).getInitialConfig().getDefaultProfile()
.getString(DefaultDriverOption.SESSION_NAME)).isEqualTo("testcluster"); .getString(DefaultDriverOption.SESSION_NAME)).isEqualTo("testcluster");
@ -129,7 +129,7 @@ class CassandraAutoConfigurationTests {
@Test @Test
void driverConfigLoaderWithCustomSessionNameAndCustomizer() { void driverConfigLoaderWithCustomSessionNameAndCustomizer() {
this.contextRunner.withUserConfiguration(SimpleDriverConfigLoaderBuilderCustomizerConfig.class) this.contextRunner.withUserConfiguration(SimpleDriverConfigLoaderBuilderCustomizerConfig.class)
.withPropertyValues("spring.data.cassandra.session-name=testcluster").run((context) -> { .withPropertyValues("spring.cassandra.session-name=testcluster").run((context) -> {
assertThat(context).hasSingleBean(DriverConfigLoader.class); assertThat(context).hasSingleBean(DriverConfigLoader.class);
assertThat(context.getBean(DriverConfigLoader.class).getInitialConfig().getDefaultProfile() assertThat(context.getBean(DriverConfigLoader.class).getInitialConfig().getDefaultProfile()
.getString(DefaultDriverOption.SESSION_NAME)).isEqualTo("overridden-name"); .getString(DefaultDriverOption.SESSION_NAME)).isEqualTo("overridden-name");
@ -138,8 +138,8 @@ class CassandraAutoConfigurationTests {
@Test @Test
void driverConfigLoaderCustomizeConnectionOptions() { void driverConfigLoaderCustomizeConnectionOptions() {
this.contextRunner.withPropertyValues("spring.data.cassandra.connection.connect-timeout=200ms", this.contextRunner.withPropertyValues("spring.cassandra.connection.connect-timeout=200ms",
"spring.data.cassandra.connection.init-query-timeout=10").run((context) -> { "spring.cassandra.connection.init-query-timeout=10").run((context) -> {
DriverExecutionProfile config = context.getBean(DriverConfigLoader.class).getInitialConfig() DriverExecutionProfile config = context.getBean(DriverConfigLoader.class).getInitialConfig()
.getDefaultProfile(); .getDefaultProfile();
assertThat(config.getInt(DefaultDriverOption.CONNECTION_CONNECT_TIMEOUT)).isEqualTo(200); assertThat(config.getInt(DefaultDriverOption.CONNECTION_CONNECT_TIMEOUT)).isEqualTo(200);
@ -149,8 +149,8 @@ class CassandraAutoConfigurationTests {
@Test @Test
void driverConfigLoaderCustomizePoolOptions() { void driverConfigLoaderCustomizePoolOptions() {
this.contextRunner.withPropertyValues("spring.data.cassandra.pool.idle-timeout=42", this.contextRunner.withPropertyValues("spring.cassandra.pool.idle-timeout=42",
"spring.data.cassandra.pool.heartbeat-interval=62").run((context) -> { "spring.cassandra.pool.heartbeat-interval=62").run((context) -> {
DriverExecutionProfile config = context.getBean(DriverConfigLoader.class).getInitialConfig() DriverExecutionProfile config = context.getBean(DriverConfigLoader.class).getInitialConfig()
.getDefaultProfile(); .getDefaultProfile();
assertThat(config.getInt(DefaultDriverOption.HEARTBEAT_TIMEOUT)).isEqualTo(42); assertThat(config.getInt(DefaultDriverOption.HEARTBEAT_TIMEOUT)).isEqualTo(42);
@ -160,9 +160,9 @@ class CassandraAutoConfigurationTests {
@Test @Test
void driverConfigLoaderCustomizeRequestOptions() { void driverConfigLoaderCustomizeRequestOptions() {
this.contextRunner.withPropertyValues("spring.data.cassandra.request.timeout=5s", this.contextRunner
"spring.data.cassandra.request.consistency=two", .withPropertyValues("spring.cassandra.request.timeout=5s", "spring.cassandra.request.consistency=two",
"spring.data.cassandra.request.serial-consistency=quorum", "spring.data.cassandra.request.page-size=42") "spring.cassandra.request.serial-consistency=quorum", "spring.cassandra.request.page-size=42")
.run((context) -> { .run((context) -> {
DriverExecutionProfile config = context.getBean(DriverConfigLoader.class).getInitialConfig() DriverExecutionProfile config = context.getBean(DriverConfigLoader.class).getInitialConfig()
.getDefaultProfile(); .getDefaultProfile();
@ -175,8 +175,7 @@ class CassandraAutoConfigurationTests {
@Test @Test
void driverConfigLoaderCustomizeControlConnectionOptions() { void driverConfigLoaderCustomizeControlConnectionOptions() {
this.contextRunner.withPropertyValues("spring.data.cassandra.controlconnection.timeout=200ms") this.contextRunner.withPropertyValues("spring.cassandra.controlconnection.timeout=200ms").run((context) -> {
.run((context) -> {
DriverExecutionProfile config = context.getBean(DriverConfigLoader.class).getInitialConfig() DriverExecutionProfile config = context.getBean(DriverConfigLoader.class).getInitialConfig()
.getDefaultProfile(); .getDefaultProfile();
assertThat(config.getInt(DefaultDriverOption.CONTROL_CONNECTION_TIMEOUT)).isEqualTo(200); assertThat(config.getInt(DefaultDriverOption.CONTROL_CONNECTION_TIMEOUT)).isEqualTo(200);
@ -195,7 +194,7 @@ class CassandraAutoConfigurationTests {
@Test @Test
void driverConfigLoaderWithRateLimitingRequiresExtraConfiguration() { void driverConfigLoaderWithRateLimitingRequiresExtraConfiguration() {
this.contextRunner.withPropertyValues("spring.data.cassandra.request.throttler.type=rate-limiting") this.contextRunner.withPropertyValues("spring.cassandra.request.throttler.type=rate-limiting")
.run((context) -> assertThatThrownBy(() -> context.getBean(CqlSession.class)) .run((context) -> assertThatThrownBy(() -> context.getBean(CqlSession.class))
.hasMessageContaining("Error instantiating class RateLimitingRequestThrottler") .hasMessageContaining("Error instantiating class RateLimitingRequestThrottler")
.hasMessageContaining("No configuration setting found for key")); .hasMessageContaining("No configuration setting found for key"));
@ -203,9 +202,9 @@ class CassandraAutoConfigurationTests {
@Test @Test
void driverConfigLoaderCustomizeConcurrencyLimitingRequestThrottler() { void driverConfigLoaderCustomizeConcurrencyLimitingRequestThrottler() {
this.contextRunner.withPropertyValues("spring.data.cassandra.request.throttler.type=concurrency-limiting", this.contextRunner.withPropertyValues("spring.cassandra.request.throttler.type=concurrency-limiting",
"spring.data.cassandra.request.throttler.max-concurrent-requests=62", "spring.cassandra.request.throttler.max-concurrent-requests=62",
"spring.data.cassandra.request.throttler.max-queue-size=72").run((context) -> { "spring.cassandra.request.throttler.max-queue-size=72").run((context) -> {
DriverExecutionProfile config = context.getBean(DriverConfigLoader.class).getInitialConfig() DriverExecutionProfile config = context.getBean(DriverConfigLoader.class).getInitialConfig()
.getDefaultProfile(); .getDefaultProfile();
assertThat(config.getString(DefaultDriverOption.REQUEST_THROTTLER_CLASS)) assertThat(config.getString(DefaultDriverOption.REQUEST_THROTTLER_CLASS))
@ -218,10 +217,10 @@ class CassandraAutoConfigurationTests {
@Test @Test
void driverConfigLoaderCustomizeRateLimitingRequestThrottler() { void driverConfigLoaderCustomizeRateLimitingRequestThrottler() {
this.contextRunner.withPropertyValues("spring.data.cassandra.request.throttler.type=rate-limiting", this.contextRunner.withPropertyValues("spring.cassandra.request.throttler.type=rate-limiting",
"spring.data.cassandra.request.throttler.max-requests-per-second=62", "spring.cassandra.request.throttler.max-requests-per-second=62",
"spring.data.cassandra.request.throttler.max-queue-size=72", "spring.cassandra.request.throttler.max-queue-size=72",
"spring.data.cassandra.request.throttler.drain-interval=16ms").run((context) -> { "spring.cassandra.request.throttler.drain-interval=16ms").run((context) -> {
DriverExecutionProfile config = context.getBean(DriverConfigLoader.class).getInitialConfig() DriverExecutionProfile config = context.getBean(DriverConfigLoader.class).getInitialConfig()
.getDefaultProfile(); .getDefaultProfile();
assertThat(config.getString(DefaultDriverOption.REQUEST_THROTTLER_CLASS)) assertThat(config.getString(DefaultDriverOption.REQUEST_THROTTLER_CLASS))
@ -236,8 +235,8 @@ class CassandraAutoConfigurationTests {
@Test @Test
void driverConfigLoaderWithConfigComplementSettings() { void driverConfigLoaderWithConfigComplementSettings() {
String configLocation = "org/springframework/boot/autoconfigure/cassandra/simple.conf"; String configLocation = "org/springframework/boot/autoconfigure/cassandra/simple.conf";
this.contextRunner.withPropertyValues("spring.data.cassandra.session-name=testcluster", this.contextRunner.withPropertyValues("spring.cassandra.session-name=testcluster",
"spring.data.cassandra.config=" + configLocation).run((context) -> { "spring.cassandra.config=" + configLocation).run((context) -> {
assertThat(context).hasSingleBean(DriverConfigLoader.class); assertThat(context).hasSingleBean(DriverConfigLoader.class);
assertThat(context.getBean(DriverConfigLoader.class).getInitialConfig().getDefaultProfile() assertThat(context.getBean(DriverConfigLoader.class).getInitialConfig().getDefaultProfile()
.getString(DefaultDriverOption.SESSION_NAME)).isEqualTo("testcluster"); .getString(DefaultDriverOption.SESSION_NAME)).isEqualTo("testcluster");
@ -249,7 +248,7 @@ class CassandraAutoConfigurationTests {
@Test // gh-31238 @Test // gh-31238
void driverConfigLoaderWithConfigOverridesDefaults() { void driverConfigLoaderWithConfigOverridesDefaults() {
String configLocation = "org/springframework/boot/autoconfigure/cassandra/override-defaults.conf"; String configLocation = "org/springframework/boot/autoconfigure/cassandra/override-defaults.conf";
this.contextRunner.withPropertyValues("spring.data.cassandra.config=" + configLocation).run((context) -> { this.contextRunner.withPropertyValues("spring.cassandra.config=" + configLocation).run((context) -> {
DriverExecutionProfile actual = context.getBean(DriverConfigLoader.class).getInitialConfig() DriverExecutionProfile actual = context.getBean(DriverConfigLoader.class).getInitialConfig()
.getDefaultProfile(); .getDefaultProfile();
assertThat(actual.getString(DefaultDriverOption.SESSION_NAME)).isEqualTo("advanced session"); assertThat(actual.getString(DefaultDriverOption.SESSION_NAME)).isEqualTo("advanced session");
@ -271,7 +270,7 @@ class CassandraAutoConfigurationTests {
@Test @Test
void driverConfigLoaderWithConfigCreateProfiles() { void driverConfigLoaderWithConfigCreateProfiles() {
String configLocation = "org/springframework/boot/autoconfigure/cassandra/profiles.conf"; String configLocation = "org/springframework/boot/autoconfigure/cassandra/profiles.conf";
this.contextRunner.withPropertyValues("spring.data.cassandra.config=" + configLocation).run((context) -> { this.contextRunner.withPropertyValues("spring.cassandra.config=" + configLocation).run((context) -> {
assertThat(context).hasSingleBean(DriverConfigLoader.class); assertThat(context).hasSingleBean(DriverConfigLoader.class);
DriverConfig driverConfig = context.getBean(DriverConfigLoader.class).getInitialConfig(); DriverConfig driverConfig = context.getBean(DriverConfigLoader.class).getInitialConfig();
assertThat(driverConfig.getProfiles()).containsOnlyKeys("default", "first", "second"); assertThat(driverConfig.getProfiles()).containsOnlyKeys("default", "first", "second");

@ -56,17 +56,15 @@ class CassandraAutoConfigurationWithPasswordAuthenticationIntegrationTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(CassandraAutoConfiguration.class)).withPropertyValues( .withConfiguration(AutoConfigurations.of(CassandraAutoConfiguration.class)).withPropertyValues(
"spring.data.cassandra.contact-points:" + cassandra.getHost() + ":" "spring.cassandra.contact-points:" + cassandra.getHost() + ":" + cassandra.getFirstMappedPort(),
+ cassandra.getFirstMappedPort(), "spring.cassandra.local-datacenter=datacenter1", "spring.cassandra.connection.connect-timeout=60s",
"spring.data.cassandra.local-datacenter=datacenter1", "spring.cassandra.connection.init-query-timeout=60s", "spring.cassandra.request.timeout=60s");
"spring.data.cassandra.connection.connect-timeout=60s",
"spring.data.cassandra.connection.init-query-timeout=60s",
"spring.data.cassandra.request.timeout=60s");
@Test @Test
void authenticationWithValidUsernameAndPassword() { void authenticationWithValidUsernameAndPassword() {
this.contextRunner.withPropertyValues("spring.data.cassandra.username=cassandra", this.contextRunner
"spring.data.cassandra.password=cassandra").run((context) -> { .withPropertyValues("spring.cassandra.username=cassandra", "spring.cassandra.password=cassandra")
.run((context) -> {
SimpleStatement select = SimpleStatement.newInstance("SELECT release_version FROM system.local") SimpleStatement select = SimpleStatement.newInstance("SELECT release_version FROM system.local")
.setConsistencyLevel(ConsistencyLevel.LOCAL_ONE); .setConsistencyLevel(ConsistencyLevel.LOCAL_ONE);
assertThat(context.getBean(CqlSession.class).execute(select).one()).isNotNull(); assertThat(context.getBean(CqlSession.class).execute(select).one()).isNotNull();
@ -76,8 +74,8 @@ class CassandraAutoConfigurationWithPasswordAuthenticationIntegrationTests {
@Test @Test
void authenticationWithInvalidCredentials() { void authenticationWithInvalidCredentials() {
this.contextRunner this.contextRunner
.withPropertyValues("spring.data.cassandra.username=not-a-user", .withPropertyValues("spring.cassandra.username=not-a-user",
"spring.data.cassandra.password=invalid-password") "spring.cassandra.password=invalid-password")
.run((context) -> assertThatThrownBy(() -> context.getBean(CqlSession.class)) .run((context) -> assertThatThrownBy(() -> context.getBean(CqlSession.class))
.hasMessageContaining("Authentication error")); .hasMessageContaining("Authentication error"));
} }

@ -40,21 +40,21 @@ class CassandraPropertiesTests {
@Test @Test
void defaultValuesInManualMetadataAreConsistent() { void defaultValuesInManualMetadataAreConsistent() {
OptionsMap driverDefaults = OptionsMap.driverDefaults(); OptionsMap driverDefaults = OptionsMap.driverDefaults();
// spring.data.cassandra.connection.connect-timeout // spring.cassandra.connection.connect-timeout
assertThat(driverDefaults.get(TypedDriverOption.CONNECTION_CONNECT_TIMEOUT)).isEqualTo(Duration.ofSeconds(5)); assertThat(driverDefaults.get(TypedDriverOption.CONNECTION_CONNECT_TIMEOUT)).isEqualTo(Duration.ofSeconds(5));
// spring.data.cassandra.connection.init-query-timeout // spring.cassandra.connection.init-query-timeout
assertThat(driverDefaults.get(TypedDriverOption.CONNECTION_INIT_QUERY_TIMEOUT)) assertThat(driverDefaults.get(TypedDriverOption.CONNECTION_INIT_QUERY_TIMEOUT))
.isEqualTo(Duration.ofSeconds(5)); .isEqualTo(Duration.ofSeconds(5));
// spring.data.cassandra.request.timeout // spring.cassandra.request.timeout
assertThat(driverDefaults.get(TypedDriverOption.REQUEST_TIMEOUT)).isEqualTo(Duration.ofSeconds(2)); assertThat(driverDefaults.get(TypedDriverOption.REQUEST_TIMEOUT)).isEqualTo(Duration.ofSeconds(2));
// spring.data.cassandra.request.page-size // spring.cassandra.request.page-size
assertThat(driverDefaults.get(TypedDriverOption.REQUEST_PAGE_SIZE)).isEqualTo(5000); assertThat(driverDefaults.get(TypedDriverOption.REQUEST_PAGE_SIZE)).isEqualTo(5000);
// spring.data.cassandra.request.throttler.type // spring.cassandra.request.throttler.type
assertThat(driverDefaults.get(TypedDriverOption.REQUEST_THROTTLER_CLASS)) assertThat(driverDefaults.get(TypedDriverOption.REQUEST_THROTTLER_CLASS))
.isEqualTo("PassThroughRequestThrottler"); // "none" .isEqualTo("PassThroughRequestThrottler"); // "none"
// spring.data.cassandra.pool.heartbeat-interval // spring.cassandra.pool.heartbeat-interval
assertThat(driverDefaults.get(TypedDriverOption.HEARTBEAT_INTERVAL)).isEqualTo(Duration.ofSeconds(30)); assertThat(driverDefaults.get(TypedDriverOption.HEARTBEAT_INTERVAL)).isEqualTo(Duration.ofSeconds(30));
// spring.data.cassandra.pool.idle-timeout // spring.cassandra.pool.idle-timeout
assertThat(driverDefaults.get(TypedDriverOption.HEARTBEAT_TIMEOUT)).isEqualTo(Duration.ofSeconds(5)); assertThat(driverDefaults.get(TypedDriverOption.HEARTBEAT_TIMEOUT)).isEqualTo(Duration.ofSeconds(5));
} }

@ -52,12 +52,9 @@ class CassandraDataAutoConfigurationIntegrationTests {
.withConfiguration( .withConfiguration(
AutoConfigurations.of(CassandraAutoConfiguration.class, CassandraDataAutoConfiguration.class)) AutoConfigurations.of(CassandraAutoConfiguration.class, CassandraDataAutoConfiguration.class))
.withPropertyValues( .withPropertyValues(
"spring.data.cassandra.contact-points:" + cassandra.getHost() + ":" "spring.cassandra.contact-points:" + cassandra.getHost() + ":" + cassandra.getFirstMappedPort(),
+ cassandra.getFirstMappedPort(), "spring.cassandra.local-datacenter=datacenter1", "spring.cassandra.connection.connect-timeout=60s",
"spring.data.cassandra.local-datacenter=datacenter1", "spring.cassandra.connection.init-query-timeout=60s", "spring.cassandra.request.timeout=60s")
"spring.data.cassandra.connection.connect-timeout=60s",
"spring.data.cassandra.connection.init-query-timeout=60s",
"spring.data.cassandra.request.timeout=60s")
.withInitializer((context) -> AutoConfigurationPackages.register((BeanDefinitionRegistry) context, .withInitializer((context) -> AutoConfigurationPackages.register((BeanDefinitionRegistry) context,
City.class.getPackage().getName())); City.class.getPackage().getName()));
@ -70,7 +67,7 @@ class CassandraDataAutoConfigurationIntegrationTests {
@Test @Test
void hasRecreateSchemaActionSet() { void hasRecreateSchemaActionSet() {
this.contextRunner.withUserConfiguration(KeyspaceTestConfiguration.class) this.contextRunner.withUserConfiguration(KeyspaceTestConfiguration.class)
.withPropertyValues("spring.data.cassandra.schemaAction=recreate_drop_unused") .withPropertyValues("spring.cassandra.schemaAction=recreate_drop_unused")
.run((context) -> assertThat(context.getBean(SessionFactoryFactoryBean.class)) .run((context) -> assertThat(context.getBean(SessionFactoryFactoryBean.class))
.hasFieldOrPropertyWithValue("schemaAction", SchemaAction.RECREATE_DROP_UNUSED)); .hasFieldOrPropertyWithValue("schemaAction", SchemaAction.RECREATE_DROP_UNUSED));
} }

@ -110,7 +110,7 @@ class CassandraDataAutoConfigurationTests {
void load(Class<?>... config) { void load(Class<?>... config) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
TestPropertyValues.of("spring.data.cassandra.keyspaceName:boot_test").applyTo(ctx); TestPropertyValues.of("spring.cassandra.keyspaceName:boot_test").applyTo(ctx);
if (!ObjectUtils.isEmpty(config)) { if (!ObjectUtils.isEmpty(config)) {
ctx.register(config); ctx.register(config);
} }

@ -54,13 +54,13 @@ class CassandraReactiveDataAutoConfigurationTests {
@Test @Test
void templateExists() { void templateExists() {
load("spring.data.cassandra.keyspaceName:boot_test"); load("spring.cassandra.keyspaceName:boot_test");
assertThat(this.context.getBeanNamesForType(ReactiveCassandraTemplate.class)).hasSize(1); assertThat(this.context.getBeanNamesForType(ReactiveCassandraTemplate.class)).hasSize(1);
} }
@Test @Test
void entityScanShouldSetManagedTypes() { void entityScanShouldSetManagedTypes() {
load(EntityScanConfig.class, "spring.data.cassandra.keyspaceName:boot_test"); load(EntityScanConfig.class, "spring.cassandra.keyspaceName:boot_test");
CassandraMappingContext mappingContext = this.context.getBean(CassandraMappingContext.class); CassandraMappingContext mappingContext = this.context.getBean(CassandraMappingContext.class);
ManagedTypes managedTypes = (ManagedTypes) ReflectionTestUtils.getField(mappingContext, "managedTypes"); ManagedTypes managedTypes = (ManagedTypes) ReflectionTestUtils.getField(mappingContext, "managedTypes");
assertThat(managedTypes.toList()).containsOnly(City.class); assertThat(managedTypes.toList()).containsOnly(City.class);
@ -68,7 +68,7 @@ class CassandraReactiveDataAutoConfigurationTests {
@Test @Test
void userTypeResolverShouldBeSet() { void userTypeResolverShouldBeSet() {
load("spring.data.cassandra.keyspaceName:boot_test"); load("spring.cassandra.keyspaceName:boot_test");
CassandraConverter cassandraConverter = this.context.getBean(CassandraConverter.class); CassandraConverter cassandraConverter = this.context.getBean(CassandraConverter.class);
assertThat(cassandraConverter).extracting("userTypeResolver").isInstanceOf(SimpleUserTypeResolver.class); assertThat(cassandraConverter).extracting("userTypeResolver").isInstanceOf(SimpleUserTypeResolver.class);
} }

@ -79,14 +79,14 @@ class CassandraRepositoriesAutoConfigurationTests {
@Test @Test
void enablingReactiveRepositoriesDisablesImperativeRepositories() { void enablingReactiveRepositoriesDisablesImperativeRepositories() {
this.contextRunner.withUserConfiguration(DefaultConfiguration.class) this.contextRunner.withUserConfiguration(DefaultConfiguration.class)
.withPropertyValues("spring.data.cassandra.repositories.type=reactive") .withPropertyValues("spring.cassandra.repositories.type=reactive")
.run((context) -> assertThat(context).doesNotHaveBean(CityCassandraRepository.class)); .run((context) -> assertThat(context).doesNotHaveBean(CityCassandraRepository.class));
} }
@Test @Test
void enablingNoRepositoriesDisablesImperativeRepositories() { void enablingNoRepositoriesDisablesImperativeRepositories() {
this.contextRunner.withUserConfiguration(DefaultConfiguration.class) this.contextRunner.withUserConfiguration(DefaultConfiguration.class)
.withPropertyValues("spring.data.cassandra.repositories.type=none") .withPropertyValues("spring.cassandra.repositories.type=none")
.run((context) -> assertThat(context).doesNotHaveBean(CityCassandraRepository.class)); .run((context) -> assertThat(context).doesNotHaveBean(CityCassandraRepository.class));
} }

@ -54,13 +54,14 @@ class RedisAutoConfigurationJedisTests {
@Test @Test
void connectionFactoryIsNotCreatedWhenLettuceIsSelected() { void connectionFactoryIsNotCreatedWhenLettuceIsSelected() {
this.contextRunner.withPropertyValues("spring.redis.client-type=lettuce") this.contextRunner.withPropertyValues("spring.data.redis.client-type=lettuce")
.run((context) -> assertThat(context).doesNotHaveBean(RedisConnectionFactory.class)); .run((context) -> assertThat(context).doesNotHaveBean(RedisConnectionFactory.class));
} }
@Test @Test
void testOverrideRedisConfiguration() { void testOverrideRedisConfiguration() {
this.contextRunner.withPropertyValues("spring.redis.host:foo", "spring.redis.database:1").run((context) -> { this.contextRunner.withPropertyValues("spring.data.redis.host:foo", "spring.data.redis.database:1")
.run((context) -> {
JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class); JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("foo"); assertThat(cf.getHostName()).isEqualTo("foo");
assertThat(cf.getDatabase()).isEqualTo(1); assertThat(cf.getDatabase()).isEqualTo(1);
@ -80,9 +81,8 @@ class RedisAutoConfigurationJedisTests {
@Test @Test
void testRedisUrlConfiguration() { void testRedisUrlConfiguration() {
this.contextRunner this.contextRunner.withPropertyValues("spring.data.redis.host:foo",
.withPropertyValues("spring.redis.host:foo", "spring.redis.url:redis://user:password@example:33") "spring.data.redis.url:redis://user:password@example:33").run((context) -> {
.run((context) -> {
JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class); JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("example"); assertThat(cf.getHostName()).isEqualTo("example");
assertThat(cf.getPort()).isEqualTo(33); assertThat(cf.getPort()).isEqualTo(33);
@ -94,10 +94,9 @@ class RedisAutoConfigurationJedisTests {
@Test @Test
void testOverrideUrlRedisConfiguration() { void testOverrideUrlRedisConfiguration() {
this.contextRunner this.contextRunner.withPropertyValues("spring.data.redis.host:foo", "spring.data.redis.password:xyz",
.withPropertyValues("spring.redis.host:foo", "spring.redis.password:xyz", "spring.redis.port:1000", "spring.data.redis.port:1000", "spring.data.redis.ssl:false",
"spring.redis.ssl:false", "spring.redis.url:rediss://user:password@example:33") "spring.data.redis.url:rediss://user:password@example:33").run((context) -> {
.run((context) -> {
JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class); JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("example"); assertThat(cf.getHostName()).isEqualTo("example");
assertThat(cf.getPort()).isEqualTo(33); assertThat(cf.getPort()).isEqualTo(33);
@ -109,7 +108,7 @@ class RedisAutoConfigurationJedisTests {
@Test @Test
void testPasswordInUrlWithColon() { void testPasswordInUrlWithColon() {
this.contextRunner.withPropertyValues("spring.redis.url:redis://:pass:word@example:33").run((context) -> { this.contextRunner.withPropertyValues("spring.data.redis.url:redis://:pass:word@example:33").run((context) -> {
JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class); JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("example"); assertThat(cf.getHostName()).isEqualTo("example");
assertThat(cf.getPort()).isEqualTo(33); assertThat(cf.getPort()).isEqualTo(33);
@ -120,7 +119,8 @@ class RedisAutoConfigurationJedisTests {
@Test @Test
void testPasswordInUrlStartsWithColon() { void testPasswordInUrlStartsWithColon() {
this.contextRunner.withPropertyValues("spring.redis.url:redis://user::pass:word@example:33").run((context) -> { this.contextRunner.withPropertyValues("spring.data.redis.url:redis://user::pass:word@example:33")
.run((context) -> {
JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class); JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("example"); assertThat(cf.getHostName()).isEqualTo("example");
assertThat(cf.getPort()).isEqualTo(33); assertThat(cf.getPort()).isEqualTo(33);
@ -131,10 +131,10 @@ class RedisAutoConfigurationJedisTests {
@Test @Test
void testRedisConfigurationWithPool() { void testRedisConfigurationWithPool() {
this.contextRunner.withPropertyValues("spring.redis.host:foo", "spring.redis.jedis.pool.min-idle:1", this.contextRunner.withPropertyValues("spring.data.redis.host:foo", "spring.data.redis.jedis.pool.min-idle:1",
"spring.redis.jedis.pool.max-idle:4", "spring.redis.jedis.pool.max-active:16", "spring.data.redis.jedis.pool.max-idle:4", "spring.data.redis.jedis.pool.max-active:16",
"spring.redis.jedis.pool.max-wait:2000", "spring.redis.jedis.pool.time-between-eviction-runs:30000") "spring.data.redis.jedis.pool.max-wait:2000",
.run((context) -> { "spring.data.redis.jedis.pool.time-between-eviction-runs:30000").run((context) -> {
JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class); JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("foo"); assertThat(cf.getHostName()).isEqualTo("foo");
assertThat(cf.getPoolConfig().getMinIdle()).isEqualTo(1); assertThat(cf.getPoolConfig().getMinIdle()).isEqualTo(1);
@ -147,7 +147,8 @@ class RedisAutoConfigurationJedisTests {
@Test @Test
void testRedisConfigurationDisabledPool() { void testRedisConfigurationDisabledPool() {
this.contextRunner.withPropertyValues("spring.redis.host:foo", "spring.redis.jedis.pool.enabled:false") this.contextRunner
.withPropertyValues("spring.data.redis.host:foo", "spring.data.redis.jedis.pool.enabled:false")
.run((context) -> { .run((context) -> {
JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class); JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("foo"); assertThat(cf.getHostName()).isEqualTo("foo");
@ -157,8 +158,8 @@ class RedisAutoConfigurationJedisTests {
@Test @Test
void testRedisConfigurationWithTimeoutAndConnectTimeout() { void testRedisConfigurationWithTimeoutAndConnectTimeout() {
this.contextRunner.withPropertyValues("spring.redis.host:foo", "spring.redis.timeout:250", this.contextRunner.withPropertyValues("spring.data.redis.host:foo", "spring.data.redis.timeout:250",
"spring.redis.connect-timeout:1000").run((context) -> { "spring.data.redis.connect-timeout:1000").run((context) -> {
JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class); JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("foo"); assertThat(cf.getHostName()).isEqualTo("foo");
assertThat(cf.getTimeout()).isEqualTo(250); assertThat(cf.getTimeout()).isEqualTo(250);
@ -168,7 +169,7 @@ class RedisAutoConfigurationJedisTests {
@Test @Test
void testRedisConfigurationWithDefaultTimeouts() { void testRedisConfigurationWithDefaultTimeouts() {
this.contextRunner.withPropertyValues("spring.redis.host:foo").run((context) -> { this.contextRunner.withPropertyValues("spring.data.redis.host:foo").run((context) -> {
JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class); JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("foo"); assertThat(cf.getHostName()).isEqualTo("foo");
assertThat(cf.getTimeout()).isEqualTo(2000); assertThat(cf.getTimeout()).isEqualTo(2000);
@ -178,7 +179,7 @@ class RedisAutoConfigurationJedisTests {
@Test @Test
void testRedisConfigurationWithClientName() { void testRedisConfigurationWithClientName() {
this.contextRunner.withPropertyValues("spring.redis.host:foo", "spring.redis.client-name:spring-boot") this.contextRunner.withPropertyValues("spring.data.redis.host:foo", "spring.data.redis.client-name:spring-boot")
.run((context) -> { .run((context) -> {
JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class); JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("foo"); assertThat(cf.getHostName()).isEqualTo("foo");
@ -189,8 +190,8 @@ class RedisAutoConfigurationJedisTests {
@Test @Test
void testRedisConfigurationWithSentinel() { void testRedisConfigurationWithSentinel() {
this.contextRunner this.contextRunner
.withPropertyValues("spring.redis.sentinel.master:mymaster", .withPropertyValues("spring.data.redis.sentinel.master:mymaster",
"spring.redis.sentinel.nodes:127.0.0.1:26379,127.0.0.1:26380") "spring.data.redis.sentinel.nodes:127.0.0.1:26379,127.0.0.1:26380")
.withUserConfiguration(JedisConnectionFactoryCaptorConfiguration.class) .withUserConfiguration(JedisConnectionFactoryCaptorConfiguration.class)
.run((context) -> assertThat(JedisConnectionFactoryCaptor.connectionFactory.isRedisSentinelAware()) .run((context) -> assertThat(JedisConnectionFactoryCaptor.connectionFactory.isRedisSentinelAware())
.isTrue()); .isTrue());
@ -198,8 +199,10 @@ class RedisAutoConfigurationJedisTests {
@Test @Test
void testRedisConfigurationWithSentinelAndAuthentication() { void testRedisConfigurationWithSentinelAndAuthentication() {
this.contextRunner.withPropertyValues("spring.redis.username=user", "spring.redis.password=password", this.contextRunner
"spring.redis.sentinel.master:mymaster", "spring.redis.sentinel.nodes:127.0.0.1:26379,127.0.0.1:26380") .withPropertyValues("spring.data.redis.username=user", "spring.data.redis.password=password",
"spring.data.redis.sentinel.master:mymaster",
"spring.data.redis.sentinel.nodes:127.0.0.1:26379,127.0.0.1:26380")
.withUserConfiguration(JedisConnectionFactoryCaptorConfiguration.class).run((context) -> { .withUserConfiguration(JedisConnectionFactoryCaptorConfiguration.class).run((context) -> {
assertThat(JedisConnectionFactoryCaptor.connectionFactory.isRedisSentinelAware()).isTrue(); assertThat(JedisConnectionFactoryCaptor.connectionFactory.isRedisSentinelAware()).isTrue();
assertThat(getUserName(JedisConnectionFactoryCaptor.connectionFactory)).isEqualTo("user"); assertThat(getUserName(JedisConnectionFactoryCaptor.connectionFactory)).isEqualTo("user");
@ -209,7 +212,7 @@ class RedisAutoConfigurationJedisTests {
@Test @Test
void testRedisConfigurationWithCluster() { void testRedisConfigurationWithCluster() {
this.contextRunner.withPropertyValues("spring.redis.cluster.nodes=127.0.0.1:27379,127.0.0.1:27380") this.contextRunner.withPropertyValues("spring.data.redis.cluster.nodes=127.0.0.1:27379,127.0.0.1:27380")
.withUserConfiguration(JedisConnectionFactoryCaptorConfiguration.class) .withUserConfiguration(JedisConnectionFactoryCaptorConfiguration.class)
.run((context) -> assertThat(JedisConnectionFactoryCaptor.connectionFactory.isRedisClusterAware()) .run((context) -> assertThat(JedisConnectionFactoryCaptor.connectionFactory.isRedisClusterAware())
.isTrue()); .isTrue());

@ -39,7 +39,7 @@ class RedisAutoConfigurationLettuceWithoutCommonsPool2Tests {
@Test @Test
void poolWithoutCommonsPool2IsDisabledByDefault() { void poolWithoutCommonsPool2IsDisabledByDefault() {
this.contextRunner.withPropertyValues("spring.redis.host:foo").run((context) -> { this.contextRunner.withPropertyValues("spring.data.redis.host:foo").run((context) -> {
LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class); LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("foo"); assertThat(cf.getHostName()).isEqualTo("foo");
assertThat(cf.getClientConfiguration()).isNotInstanceOf(LettucePoolingClientConfiguration.class); assertThat(cf.getClientConfiguration()).isNotInstanceOf(LettucePoolingClientConfiguration.class);

@ -90,8 +90,8 @@ class RedisAutoConfigurationTests {
@Test @Test
void testOverrideRedisConfiguration() { void testOverrideRedisConfiguration() {
this.contextRunner.withPropertyValues("spring.redis.host:foo", "spring.redis.database:1", this.contextRunner.withPropertyValues("spring.data.redis.host:foo", "spring.data.redis.database:1",
"spring.redis.lettuce.shutdown-timeout:500").run((context) -> { "spring.data.redis.lettuce.shutdown-timeout:500").run((context) -> {
LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class); LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("foo"); assertThat(cf.getHostName()).isEqualTo("foo");
assertThat(cf.getDatabase()).isEqualTo(1); assertThat(cf.getDatabase()).isEqualTo(1);
@ -122,9 +122,8 @@ class RedisAutoConfigurationTests {
@Test @Test
void testRedisUrlConfiguration() { void testRedisUrlConfiguration() {
this.contextRunner this.contextRunner.withPropertyValues("spring.data.redis.host:foo",
.withPropertyValues("spring.redis.host:foo", "spring.redis.url:redis://user:password@example:33") "spring.data.redis.url:redis://user:password@example:33").run((context) -> {
.run((context) -> {
LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class); LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("example"); assertThat(cf.getHostName()).isEqualTo("example");
assertThat(cf.getPort()).isEqualTo(33); assertThat(cf.getPort()).isEqualTo(33);
@ -136,10 +135,9 @@ class RedisAutoConfigurationTests {
@Test @Test
void testOverrideUrlRedisConfiguration() { void testOverrideUrlRedisConfiguration() {
this.contextRunner this.contextRunner.withPropertyValues("spring.data.redis.host:foo", "spring.data.redis.password:xyz",
.withPropertyValues("spring.redis.host:foo", "spring.redis.password:xyz", "spring.redis.port:1000", "spring.data.redis.port:1000", "spring.data.redis.ssl:false",
"spring.redis.ssl:false", "spring.redis.url:rediss://user:password@example:33") "spring.data.redis.url:rediss://user:password@example:33").run((context) -> {
.run((context) -> {
LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class); LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("example"); assertThat(cf.getHostName()).isEqualTo("example");
assertThat(cf.getPort()).isEqualTo(33); assertThat(cf.getPort()).isEqualTo(33);
@ -151,7 +149,7 @@ class RedisAutoConfigurationTests {
@Test @Test
void testPasswordInUrlWithColon() { void testPasswordInUrlWithColon() {
this.contextRunner.withPropertyValues("spring.redis.url:redis://:pass:word@example:33").run((context) -> { this.contextRunner.withPropertyValues("spring.data.redis.url:redis://:pass:word@example:33").run((context) -> {
LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class); LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("example"); assertThat(cf.getHostName()).isEqualTo("example");
assertThat(cf.getPort()).isEqualTo(33); assertThat(cf.getPort()).isEqualTo(33);
@ -162,7 +160,8 @@ class RedisAutoConfigurationTests {
@Test @Test
void testPasswordInUrlStartsWithColon() { void testPasswordInUrlStartsWithColon() {
this.contextRunner.withPropertyValues("spring.redis.url:redis://user::pass:word@example:33").run((context) -> { this.contextRunner.withPropertyValues("spring.data.redis.url:redis://user::pass:word@example:33")
.run((context) -> {
LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class); LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("example"); assertThat(cf.getHostName()).isEqualTo("example");
assertThat(cf.getPort()).isEqualTo(33); assertThat(cf.getPort()).isEqualTo(33);
@ -174,7 +173,7 @@ class RedisAutoConfigurationTests {
@Test @Test
void testRedisConfigurationUsePoolByDefault() { void testRedisConfigurationUsePoolByDefault() {
Pool defaultPool = new RedisProperties().getLettuce().getPool(); Pool defaultPool = new RedisProperties().getLettuce().getPool();
this.contextRunner.withPropertyValues("spring.redis.host:foo").run((context) -> { this.contextRunner.withPropertyValues("spring.data.redis.host:foo").run((context) -> {
LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class); LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("foo"); assertThat(cf.getHostName()).isEqualTo("foo");
GenericObjectPoolConfig<?> poolConfig = getPoolingClientConfiguration(cf).getPoolConfig(); GenericObjectPoolConfig<?> poolConfig = getPoolingClientConfiguration(cf).getPoolConfig();
@ -187,10 +186,11 @@ class RedisAutoConfigurationTests {
@Test @Test
void testRedisConfigurationWithCustomPoolSettings() { void testRedisConfigurationWithCustomPoolSettings() {
this.contextRunner.withPropertyValues("spring.redis.host:foo", "spring.redis.lettuce.pool.min-idle:1", this.contextRunner.withPropertyValues("spring.data.redis.host:foo", "spring.data.redis.lettuce.pool.min-idle:1",
"spring.redis.lettuce.pool.max-idle:4", "spring.redis.lettuce.pool.max-active:16", "spring.data.redis.lettuce.pool.max-idle:4", "spring.data.redis.lettuce.pool.max-active:16",
"spring.redis.lettuce.pool.max-wait:2000", "spring.redis.lettuce.pool.time-between-eviction-runs:30000", "spring.data.redis.lettuce.pool.max-wait:2000",
"spring.redis.lettuce.shutdown-timeout:1000").run((context) -> { "spring.data.redis.lettuce.pool.time-between-eviction-runs:30000",
"spring.data.redis.lettuce.shutdown-timeout:1000").run((context) -> {
LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class); LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("foo"); assertThat(cf.getHostName()).isEqualTo("foo");
GenericObjectPoolConfig<?> poolConfig = getPoolingClientConfiguration(cf).getPoolConfig(); GenericObjectPoolConfig<?> poolConfig = getPoolingClientConfiguration(cf).getPoolConfig();
@ -205,7 +205,8 @@ class RedisAutoConfigurationTests {
@Test @Test
void testRedisConfigurationDisabledPool() { void testRedisConfigurationDisabledPool() {
this.contextRunner.withPropertyValues("spring.redis.host:foo", "spring.redis.lettuce.pool.enabled:false") this.contextRunner
.withPropertyValues("spring.data.redis.host:foo", "spring.data.redis.lettuce.pool.enabled:false")
.run((context) -> { .run((context) -> {
LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class); LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("foo"); assertThat(cf.getHostName()).isEqualTo("foo");
@ -215,8 +216,8 @@ class RedisAutoConfigurationTests {
@Test @Test
void testRedisConfigurationWithTimeoutAndConnectTimeout() { void testRedisConfigurationWithTimeoutAndConnectTimeout() {
this.contextRunner.withPropertyValues("spring.redis.host:foo", "spring.redis.timeout:250", this.contextRunner.withPropertyValues("spring.data.redis.host:foo", "spring.data.redis.timeout:250",
"spring.redis.connect-timeout:1000").run((context) -> { "spring.data.redis.connect-timeout:1000").run((context) -> {
LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class); LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("foo"); assertThat(cf.getHostName()).isEqualTo("foo");
assertThat(cf.getTimeout()).isEqualTo(250); assertThat(cf.getTimeout()).isEqualTo(250);
@ -227,7 +228,7 @@ class RedisAutoConfigurationTests {
@Test @Test
void testRedisConfigurationWithDefaultTimeouts() { void testRedisConfigurationWithDefaultTimeouts() {
this.contextRunner.withPropertyValues("spring.redis.host:foo").run((context) -> { this.contextRunner.withPropertyValues("spring.data.redis.host:foo").run((context) -> {
LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class); LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("foo"); assertThat(cf.getHostName()).isEqualTo("foo");
assertThat(cf.getTimeout()).isEqualTo(60000); assertThat(cf.getTimeout()).isEqualTo(60000);
@ -246,7 +247,7 @@ class RedisAutoConfigurationTests {
@Test @Test
void testRedisConfigurationWithClientName() { void testRedisConfigurationWithClientName() {
this.contextRunner.withPropertyValues("spring.redis.host:foo", "spring.redis.client-name:spring-boot") this.contextRunner.withPropertyValues("spring.data.redis.host:foo", "spring.data.redis.client-name:spring-boot")
.run((context) -> { .run((context) -> {
LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class); LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("foo"); assertThat(cf.getHostName()).isEqualTo("foo");
@ -256,7 +257,7 @@ class RedisAutoConfigurationTests {
@Test @Test
void connectionFactoryWithJedisClientType() { void connectionFactoryWithJedisClientType() {
this.contextRunner.withPropertyValues("spring.redis.client-type:jedis").run((context) -> { this.contextRunner.withPropertyValues("spring.data.redis.client-type:jedis").run((context) -> {
assertThat(context).hasSingleBean(RedisConnectionFactory.class); assertThat(context).hasSingleBean(RedisConnectionFactory.class);
assertThat(context.getBean(RedisConnectionFactory.class)).isInstanceOf(JedisConnectionFactory.class); assertThat(context.getBean(RedisConnectionFactory.class)).isInstanceOf(JedisConnectionFactory.class);
}); });
@ -264,7 +265,7 @@ class RedisAutoConfigurationTests {
@Test @Test
void connectionFactoryWithLettuceClientType() { void connectionFactoryWithLettuceClientType() {
this.contextRunner.withPropertyValues("spring.redis.client-type:lettuce").run((context) -> { this.contextRunner.withPropertyValues("spring.data.redis.client-type:lettuce").run((context) -> {
assertThat(context).hasSingleBean(RedisConnectionFactory.class); assertThat(context).hasSingleBean(RedisConnectionFactory.class);
assertThat(context.getBean(RedisConnectionFactory.class)).isInstanceOf(LettuceConnectionFactory.class); assertThat(context.getBean(RedisConnectionFactory.class)).isInstanceOf(LettuceConnectionFactory.class);
}); });
@ -274,16 +275,18 @@ class RedisAutoConfigurationTests {
void testRedisConfigurationWithSentinel() { void testRedisConfigurationWithSentinel() {
List<String> sentinels = Arrays.asList("127.0.0.1:26379", "127.0.0.1:26380"); List<String> sentinels = Arrays.asList("127.0.0.1:26379", "127.0.0.1:26380");
this.contextRunner this.contextRunner
.withPropertyValues("spring.redis.sentinel.master:mymaster", .withPropertyValues("spring.data.redis.sentinel.master:mymaster",
"spring.redis.sentinel.nodes:" + StringUtils.collectionToCommaDelimitedString(sentinels)) "spring.data.redis.sentinel.nodes:" + StringUtils.collectionToCommaDelimitedString(sentinels))
.run((context) -> assertThat(context.getBean(LettuceConnectionFactory.class).isRedisSentinelAware()) .run((context) -> assertThat(context.getBean(LettuceConnectionFactory.class).isRedisSentinelAware())
.isTrue()); .isTrue());
} }
@Test @Test
void testRedisConfigurationWithSentinelAndDatabase() { void testRedisConfigurationWithSentinelAndDatabase() {
this.contextRunner.withPropertyValues("spring.redis.database:1", "spring.redis.sentinel.master:mymaster", this.contextRunner
"spring.redis.sentinel.nodes:127.0.0.1:26379, 127.0.0.1:26380").run((context) -> { .withPropertyValues("spring.data.redis.database:1", "spring.data.redis.sentinel.master:mymaster",
"spring.data.redis.sentinel.nodes:127.0.0.1:26379, 127.0.0.1:26380")
.run((context) -> {
LettuceConnectionFactory connectionFactory = context.getBean(LettuceConnectionFactory.class); LettuceConnectionFactory connectionFactory = context.getBean(LettuceConnectionFactory.class);
assertThat(connectionFactory.getDatabase()).isEqualTo(1); assertThat(connectionFactory.getDatabase()).isEqualTo(1);
assertThat(connectionFactory.isRedisSentinelAware()).isTrue(); assertThat(connectionFactory.isRedisSentinelAware()).isTrue();
@ -293,9 +296,9 @@ class RedisAutoConfigurationTests {
@Test @Test
void testRedisConfigurationWithSentinelAndAuthentication() { void testRedisConfigurationWithSentinelAndAuthentication() {
this.contextRunner this.contextRunner
.withPropertyValues("spring.redis.username=user", "spring.redis.password=password", .withPropertyValues("spring.data.redis.username=user", "spring.data.redis.password=password",
"spring.redis.sentinel.master:mymaster", "spring.data.redis.sentinel.master:mymaster",
"spring.redis.sentinel.nodes:127.0.0.1:26379, 127.0.0.1:26380") "spring.data.redis.sentinel.nodes:127.0.0.1:26379, 127.0.0.1:26380")
.run(assertSentinelConfiguration("user", "password", (sentinelConfiguration) -> { .run(assertSentinelConfiguration("user", "password", (sentinelConfiguration) -> {
assertThat(sentinelConfiguration.getSentinelPassword().isPresent()).isFalse(); assertThat(sentinelConfiguration.getSentinelPassword().isPresent()).isFalse();
Set<RedisNode> sentinels = sentinelConfiguration.getSentinels(); Set<RedisNode> sentinels = sentinelConfiguration.getSentinels();
@ -307,9 +310,9 @@ class RedisAutoConfigurationTests {
@Test @Test
void testRedisConfigurationWithSentinelPasswordAndDataNodePassword() { void testRedisConfigurationWithSentinelPasswordAndDataNodePassword() {
this.contextRunner this.contextRunner
.withPropertyValues("spring.redis.password=password", "spring.redis.sentinel.password=secret", .withPropertyValues("spring.data.redis.password=password", "spring.data.redis.sentinel.password=secret",
"spring.redis.sentinel.master:mymaster", "spring.data.redis.sentinel.master:mymaster",
"spring.redis.sentinel.nodes:127.0.0.1:26379, 127.0.0.1:26380") "spring.data.redis.sentinel.nodes:127.0.0.1:26379, 127.0.0.1:26380")
.run(assertSentinelConfiguration(null, "password", (sentinelConfiguration) -> { .run(assertSentinelConfiguration(null, "password", (sentinelConfiguration) -> {
assertThat(sentinelConfiguration.getSentinelUsername()).isNull(); assertThat(sentinelConfiguration.getSentinelUsername()).isNull();
assertThat(new String(sentinelConfiguration.getSentinelPassword().get())).isEqualTo("secret"); assertThat(new String(sentinelConfiguration.getSentinelPassword().get())).isEqualTo("secret");
@ -322,10 +325,10 @@ class RedisAutoConfigurationTests {
@Test @Test
void testRedisConfigurationWithSentinelAuthenticationAndDataNodeAuthentication() { void testRedisConfigurationWithSentinelAuthenticationAndDataNodeAuthentication() {
this.contextRunner this.contextRunner
.withPropertyValues("spring.redis.username=username", "spring.redis.password=password", .withPropertyValues("spring.data.redis.username=username", "spring.data.redis.password=password",
"spring.redis.sentinel.username=sentinel", "spring.redis.sentinel.password=secret", "spring.data.redis.sentinel.username=sentinel", "spring.data.redis.sentinel.password=secret",
"spring.redis.sentinel.master:mymaster", "spring.data.redis.sentinel.master:mymaster",
"spring.redis.sentinel.nodes:127.0.0.1:26379, 127.0.0.1:26380") "spring.data.redis.sentinel.nodes:127.0.0.1:26379, 127.0.0.1:26380")
.run(assertSentinelConfiguration("username", "password", (sentinelConfiguration) -> { .run(assertSentinelConfiguration("username", "password", (sentinelConfiguration) -> {
assertThat(sentinelConfiguration.getSentinelUsername()).isEqualTo("sentinel"); assertThat(sentinelConfiguration.getSentinelUsername()).isEqualTo("sentinel");
assertThat(new String(sentinelConfiguration.getSentinelPassword().get())).isEqualTo("secret"); assertThat(new String(sentinelConfiguration.getSentinelPassword().get())).isEqualTo("secret");
@ -347,9 +350,8 @@ class RedisAutoConfigurationTests {
@Test @Test
void testRedisSentinelUrlConfiguration() { void testRedisSentinelUrlConfiguration() {
this.contextRunner this.contextRunner.withPropertyValues(
.withPropertyValues( "spring.data.redis.url=redis-sentinel://username:password@127.0.0.1:26379,127.0.0.1:26380/mymaster")
"spring.redis.url=redis-sentinel://username:password@127.0.0.1:26379,127.0.0.1:26380/mymaster")
.run((context) -> assertThatIllegalStateException() .run((context) -> assertThatIllegalStateException()
.isThrownBy(() -> context.getBean(LettuceConnectionFactory.class)) .isThrownBy(() -> context.getBean(LettuceConnectionFactory.class))
.withRootCauseInstanceOf(RedisUrlSyntaxException.class).havingRootCause().withMessageContaining( .withRootCauseInstanceOf(RedisUrlSyntaxException.class).havingRootCause().withMessageContaining(
@ -359,8 +361,8 @@ class RedisAutoConfigurationTests {
@Test @Test
void testRedisConfigurationWithCluster() { void testRedisConfigurationWithCluster() {
List<String> clusterNodes = Arrays.asList("127.0.0.1:27379", "127.0.0.1:27380"); List<String> clusterNodes = Arrays.asList("127.0.0.1:27379", "127.0.0.1:27380");
this.contextRunner.withPropertyValues("spring.redis.cluster.nodes[0]:" + clusterNodes.get(0), this.contextRunner.withPropertyValues("spring.data.redis.cluster.nodes[0]:" + clusterNodes.get(0),
"spring.redis.cluster.nodes[1]:" + clusterNodes.get(1)).run((context) -> { "spring.data.redis.cluster.nodes[1]:" + clusterNodes.get(1)).run((context) -> {
RedisClusterConfiguration clusterConfiguration = context.getBean(LettuceConnectionFactory.class) RedisClusterConfiguration clusterConfiguration = context.getBean(LettuceConnectionFactory.class)
.getClusterConfiguration(); .getClusterConfiguration();
assertThat(clusterConfiguration.getClusterNodes()).hasSize(2); assertThat(clusterConfiguration.getClusterNodes()).hasSize(2);
@ -374,9 +376,9 @@ class RedisAutoConfigurationTests {
@Test @Test
void testRedisConfigurationWithClusterAndAuthentication() { void testRedisConfigurationWithClusterAndAuthentication() {
List<String> clusterNodes = Arrays.asList("127.0.0.1:27379", "127.0.0.1:27380"); List<String> clusterNodes = Arrays.asList("127.0.0.1:27379", "127.0.0.1:27380");
this.contextRunner.withPropertyValues("spring.redis.username=user", "spring.redis.password=password", this.contextRunner.withPropertyValues("spring.data.redis.username=user", "spring.data.redis.password=password",
"spring.redis.cluster.nodes[0]:" + clusterNodes.get(0), "spring.data.redis.cluster.nodes[0]:" + clusterNodes.get(0),
"spring.redis.cluster.nodes[1]:" + clusterNodes.get(1)).run((context) -> { "spring.data.redis.cluster.nodes[1]:" + clusterNodes.get(1)).run((context) -> {
LettuceConnectionFactory connectionFactory = context.getBean(LettuceConnectionFactory.class); LettuceConnectionFactory connectionFactory = context.getBean(LettuceConnectionFactory.class);
assertThat(getUserName(connectionFactory)).isEqualTo("user"); assertThat(getUserName(connectionFactory)).isEqualTo("user");
assertThat(connectionFactory.getPassword()).isEqualTo("password"); assertThat(connectionFactory.getPassword()).isEqualTo("password");
@ -395,7 +397,7 @@ class RedisAutoConfigurationTests {
@Test @Test
void testRedisConfigurationWithClusterCreateClusterClientOptions() { void testRedisConfigurationWithClusterCreateClusterClientOptions() {
this.contextRunner.withPropertyValues("spring.redis.cluster.nodes=127.0.0.1:27379,127.0.0.1:27380") this.contextRunner.withPropertyValues("spring.data.redis.cluster.nodes=127.0.0.1:27379,127.0.0.1:27380")
.run(assertClientOptions(ClusterClientOptions.class, (options) -> { .run(assertClientOptions(ClusterClientOptions.class, (options) -> {
assertThat(options.getTimeoutOptions().isApplyConnectionTimeout()).isTrue(); assertThat(options.getTimeoutOptions().isApplyConnectionTimeout()).isTrue();
assertThat(options.getTimeoutOptions().isTimeoutCommands()).isTrue(); assertThat(options.getTimeoutOptions().isTimeoutCommands()).isTrue();
@ -405,8 +407,8 @@ class RedisAutoConfigurationTests {
@Test @Test
void testRedisConfigurationWithClusterRefreshPeriod() { void testRedisConfigurationWithClusterRefreshPeriod() {
this.contextRunner this.contextRunner
.withPropertyValues("spring.redis.cluster.nodes=127.0.0.1:27379,127.0.0.1:27380", .withPropertyValues("spring.data.redis.cluster.nodes=127.0.0.1:27379,127.0.0.1:27380",
"spring.redis.lettuce.cluster.refresh.period=30s") "spring.data.redis.lettuce.cluster.refresh.period=30s")
.run(assertClientOptions(ClusterClientOptions.class, .run(assertClientOptions(ClusterClientOptions.class,
(options) -> assertThat(options.getTopologyRefreshOptions().getRefreshPeriod()) (options) -> assertThat(options.getTopologyRefreshOptions().getRefreshPeriod())
.hasSeconds(30))); .hasSeconds(30)));
@ -415,8 +417,8 @@ class RedisAutoConfigurationTests {
@Test @Test
void testRedisConfigurationWithClusterAdaptiveRefresh() { void testRedisConfigurationWithClusterAdaptiveRefresh() {
this.contextRunner this.contextRunner
.withPropertyValues("spring.redis.cluster.nodes=127.0.0.1:27379,127.0.0.1:27380", .withPropertyValues("spring.data.redis.cluster.nodes=127.0.0.1:27379,127.0.0.1:27380",
"spring.redis.lettuce.cluster.refresh.adaptive=true") "spring.data.redis.lettuce.cluster.refresh.adaptive=true")
.run(assertClientOptions(ClusterClientOptions.class, .run(assertClientOptions(ClusterClientOptions.class,
(options) -> assertThat(options.getTopologyRefreshOptions().getAdaptiveRefreshTriggers()) (options) -> assertThat(options.getTopologyRefreshOptions().getAdaptiveRefreshTriggers())
.isEqualTo(EnumSet.allOf(RefreshTrigger.class)))); .isEqualTo(EnumSet.allOf(RefreshTrigger.class))));
@ -424,15 +426,15 @@ class RedisAutoConfigurationTests {
@Test @Test
void testRedisConfigurationWithClusterRefreshPeriodHasNoEffectWithNonClusteredConfiguration() { void testRedisConfigurationWithClusterRefreshPeriodHasNoEffectWithNonClusteredConfiguration() {
this.contextRunner.withPropertyValues("spring.redis.cluster.refresh.period=30s").run(assertClientOptions( this.contextRunner.withPropertyValues("spring.data.redis.cluster.refresh.period=30s").run(assertClientOptions(
ClientOptions.class, (options) -> assertThat(options.getClass()).isEqualTo(ClientOptions.class))); ClientOptions.class, (options) -> assertThat(options.getClass()).isEqualTo(ClientOptions.class)));
} }
@Test @Test
void testRedisConfigurationWithClusterDynamicRefreshSourcesEnabled() { void testRedisConfigurationWithClusterDynamicRefreshSourcesEnabled() {
this.contextRunner this.contextRunner
.withPropertyValues("spring.redis.cluster.nodes=127.0.0.1:27379,127.0.0.1:27380", .withPropertyValues("spring.data.redis.cluster.nodes=127.0.0.1:27379,127.0.0.1:27380",
"spring.redis.lettuce.cluster.refresh.dynamic-refresh-sources=true") "spring.data.redis.lettuce.cluster.refresh.dynamic-refresh-sources=true")
.run(assertClientOptions(ClusterClientOptions.class, .run(assertClientOptions(ClusterClientOptions.class,
(options) -> assertThat(options.getTopologyRefreshOptions().useDynamicRefreshSources()) (options) -> assertThat(options.getTopologyRefreshOptions().useDynamicRefreshSources())
.isTrue())); .isTrue()));
@ -441,8 +443,8 @@ class RedisAutoConfigurationTests {
@Test @Test
void testRedisConfigurationWithClusterDynamicRefreshSourcesDisabled() { void testRedisConfigurationWithClusterDynamicRefreshSourcesDisabled() {
this.contextRunner this.contextRunner
.withPropertyValues("spring.redis.cluster.nodes=127.0.0.1:27379,127.0.0.1:27380", .withPropertyValues("spring.data.redis.cluster.nodes=127.0.0.1:27379,127.0.0.1:27380",
"spring.redis.lettuce.cluster.refresh.dynamic-refresh-sources=false") "spring.data.redis.lettuce.cluster.refresh.dynamic-refresh-sources=false")
.run(assertClientOptions(ClusterClientOptions.class, .run(assertClientOptions(ClusterClientOptions.class,
(options) -> assertThat(options.getTopologyRefreshOptions().useDynamicRefreshSources()) (options) -> assertThat(options.getTopologyRefreshOptions().useDynamicRefreshSources())
.isFalse())); .isFalse()));
@ -451,8 +453,8 @@ class RedisAutoConfigurationTests {
@Test @Test
void testRedisConfigurationWithClusterDynamicSourcesUnspecifiedUsesDefault() { void testRedisConfigurationWithClusterDynamicSourcesUnspecifiedUsesDefault() {
this.contextRunner this.contextRunner
.withPropertyValues("spring.redis.cluster.nodes=127.0.0.1:27379,127.0.0.1:27380", .withPropertyValues("spring.data.redis.cluster.nodes=127.0.0.1:27379,127.0.0.1:27380",
"spring.redis.lettuce.cluster.refresh.dynamic-sources=") "spring.data.redis.lettuce.cluster.refresh.dynamic-sources=")
.run(assertClientOptions(ClusterClientOptions.class, .run(assertClientOptions(ClusterClientOptions.class,
(options) -> assertThat(options.getTopologyRefreshOptions().useDynamicRefreshSources()) (options) -> assertThat(options.getTopologyRefreshOptions().useDynamicRefreshSources())
.isEqualTo(ClusterTopologyRefreshOptions.DEFAULT_DYNAMIC_REFRESH_SOURCES))); .isEqualTo(ClusterTopologyRefreshOptions.DEFAULT_DYNAMIC_REFRESH_SOURCES)));

@ -54,7 +54,8 @@ class RedisRepositoriesAutoConfigurationTests {
@BeforeEach @BeforeEach
void setUp() { void setUp() {
TestPropertyValues.of("spring.redis.host=" + redis.getHost(), "spring.redis.port=" + redis.getFirstMappedPort()) TestPropertyValues
.of("spring.data.redis.host=" + redis.getHost(), "spring.data.redis.port=" + redis.getFirstMappedPort())
.applyTo(this.context.getEnvironment()); .applyTo(this.context.getEnvironment());
} }

@ -34,7 +34,7 @@ class RedisUrlSyntaxFailureAnalyzerTests {
RedisUrlSyntaxException exception = new RedisUrlSyntaxException("redis://invalid"); RedisUrlSyntaxException exception = new RedisUrlSyntaxException("redis://invalid");
FailureAnalysis analysis = new RedisUrlSyntaxFailureAnalyzer().analyze(exception); FailureAnalysis analysis = new RedisUrlSyntaxFailureAnalyzer().analyze(exception);
assertThat(analysis.getDescription()).contains("The URL 'redis://invalid' is not valid"); assertThat(analysis.getDescription()).contains("The URL 'redis://invalid' is not valid");
assertThat(analysis.getAction()).contains("Review the value of the property 'spring.redis.url'"); assertThat(analysis.getAction()).contains("Review the value of the property 'spring.data.redis.url'");
} }
@Test @Test
@ -54,7 +54,7 @@ class RedisUrlSyntaxFailureAnalyzerTests {
assertThat(analysis.getDescription()).contains( assertThat(analysis.getDescription()).contains(
"The URL 'redis-sentinel://username:password@127.0.0.1:26379,127.0.0.1:26380/mymaster' is not valid") "The URL 'redis-sentinel://username:password@127.0.0.1:26379,127.0.0.1:26380/mymaster' is not valid")
.contains("The scheme 'redis-sentinel' is not supported"); .contains("The scheme 'redis-sentinel' is not supported");
assertThat(analysis.getAction()).contains("Use spring.redis.sentinel properties"); assertThat(analysis.getAction()).contains("Use spring.data.redis.sentinel properties");
} }
@Test @Test

@ -102,7 +102,7 @@ class ReactiveSessionAutoConfigurationRedisTests extends AbstractSessionAutoConf
@Test @Test
void sessionCookieConfigurationIsAppliedToAutoConfiguredWebSessionIdResolver() { void sessionCookieConfigurationIsAppliedToAutoConfiguredWebSessionIdResolver() {
this.contextRunner.withUserConfiguration(Config.class).withPropertyValues( this.contextRunner.withUserConfiguration(Config.class).withPropertyValues(
"spring.redis.host=" + redis.getHost(), "spring.redis.port=" + redis.getFirstMappedPort(), "spring.data.redis.host=" + redis.getHost(), "spring.data.redis.port=" + redis.getFirstMappedPort(),
"server.reactive.session.cookie.name:JSESSIONID", "server.reactive.session.cookie.domain:.example.com", "server.reactive.session.cookie.name:JSESSIONID", "server.reactive.session.cookie.domain:.example.com",
"server.reactive.session.cookie.path:/example", "server.reactive.session.cookie.max-age:60", "server.reactive.session.cookie.path:/example", "server.reactive.session.cookie.max-age:60",
"server.reactive.session.cookie.http-only:false", "server.reactive.session.cookie.secure:false", "server.reactive.session.cookie.http-only:false", "server.reactive.session.cookie.secure:false",

@ -67,8 +67,8 @@ class SessionAutoConfigurationRedisTests extends AbstractSessionAutoConfiguratio
@Test @Test
void defaultConfig() { void defaultConfig() {
this.contextRunner this.contextRunner
.withPropertyValues("spring.redis.host=" + redis.getHost(), .withPropertyValues("spring.data.redis.host=" + redis.getHost(),
"spring.redis.port=" + redis.getFirstMappedPort()) "spring.data.redis.port=" + redis.getFirstMappedPort())
.withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class)) .withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class))
.run(validateSpringSessionUsesRedis("spring:session:event:0:created:", FlushMode.ON_SAVE, .run(validateSpringSessionUsesRedis("spring:session:event:0:created:", FlushMode.ON_SAVE,
SaveMode.ON_SET_ATTRIBUTE, "0 * * * * *")); SaveMode.ON_SET_ATTRIBUTE, "0 * * * * *"));
@ -77,8 +77,8 @@ class SessionAutoConfigurationRedisTests extends AbstractSessionAutoConfiguratio
@Test @Test
void redisTakesPrecedenceMultipleImplementations() { void redisTakesPrecedenceMultipleImplementations() {
this.contextRunner.withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class)) this.contextRunner.withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class))
.withPropertyValues("spring.redis.host=" + redis.getHost(), .withPropertyValues("spring.data.redis.host=" + redis.getHost(),
"spring.redis.port=" + redis.getFirstMappedPort()) "spring.data.redis.port=" + redis.getFirstMappedPort())
.run(validateSpringSessionUsesRedis("spring:session:event:0:created:", FlushMode.ON_SAVE, .run(validateSpringSessionUsesRedis("spring:session:event:0:created:", FlushMode.ON_SAVE,
SaveMode.ON_SET_ATTRIBUTE, "0 * * * * *")); SaveMode.ON_SET_ATTRIBUTE, "0 * * * * *"));
} }
@ -86,8 +86,8 @@ class SessionAutoConfigurationRedisTests extends AbstractSessionAutoConfiguratio
@Test @Test
void defaultConfigWithCustomTimeout() { void defaultConfigWithCustomTimeout() {
this.contextRunner this.contextRunner
.withPropertyValues("spring.redis.host=" + redis.getHost(), .withPropertyValues("spring.data.redis.host=" + redis.getHost(),
"spring.redis.port=" + redis.getFirstMappedPort(), "spring.session.timeout=1m") "spring.data.redis.port=" + redis.getFirstMappedPort(), "spring.session.timeout=1m")
.withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class)).run((context) -> { .withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class)).run((context) -> {
RedisIndexedSessionRepository repository = validateSessionRepository(context, RedisIndexedSessionRepository repository = validateSessionRepository(context,
RedisIndexedSessionRepository.class); RedisIndexedSessionRepository.class);
@ -100,8 +100,8 @@ class SessionAutoConfigurationRedisTests extends AbstractSessionAutoConfiguratio
this.contextRunner.withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class)) this.contextRunner.withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class))
.withPropertyValues("spring.session.redis.namespace=foo", "spring.session.redis.flush-mode=immediate", .withPropertyValues("spring.session.redis.namespace=foo", "spring.session.redis.flush-mode=immediate",
"spring.session.redis.save-mode=on-get-attribute", "spring.session.redis.save-mode=on-get-attribute",
"spring.session.redis.cleanup-cron=0 0 12 * * *", "spring.redis.host=" + redis.getHost(), "spring.session.redis.cleanup-cron=0 0 12 * * *", "spring.data.redis.host=" + redis.getHost(),
"spring.redis.port=" + redis.getFirstMappedPort()) "spring.data.redis.port=" + redis.getFirstMappedPort())
.run(validateSpringSessionUsesRedis("foo:event:0:created:", FlushMode.IMMEDIATE, .run(validateSpringSessionUsesRedis("foo:event:0:created:", FlushMode.IMMEDIATE,
SaveMode.ON_GET_ATTRIBUTE, "0 0 12 * * *")); SaveMode.ON_GET_ATTRIBUTE, "0 0 12 * * *"));
} }
@ -110,15 +110,16 @@ class SessionAutoConfigurationRedisTests extends AbstractSessionAutoConfiguratio
void redisSessionWithConfigureActionNone() { void redisSessionWithConfigureActionNone() {
this.contextRunner.withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class)) this.contextRunner.withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class))
.withPropertyValues("spring.session.redis.configure-action=none", .withPropertyValues("spring.session.redis.configure-action=none",
"spring.redis.host=" + redis.getHost(), "spring.redis.port=" + redis.getFirstMappedPort()) "spring.data.redis.host=" + redis.getHost(),
"spring.data.redis.port=" + redis.getFirstMappedPort())
.run(validateStrategy(ConfigureRedisAction.NO_OP.getClass())); .run(validateStrategy(ConfigureRedisAction.NO_OP.getClass()));
} }
@Test @Test
void redisSessionWithDefaultConfigureActionNone() { void redisSessionWithDefaultConfigureActionNone() {
this.contextRunner.withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class)) this.contextRunner.withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class))
.withPropertyValues("spring.redis.host=" + redis.getHost(), .withPropertyValues("spring.data.redis.host=" + redis.getHost(),
"spring.redis.port=" + redis.getFirstMappedPort()) "spring.data.redis.port=" + redis.getFirstMappedPort())
.run(validateStrategy(ConfigureNotifyKeyspaceEventsAction.class, .run(validateStrategy(ConfigureNotifyKeyspaceEventsAction.class,
entry("notify-keyspace-events", "gxE"))); entry("notify-keyspace-events", "gxE")));
} }
@ -127,8 +128,8 @@ class SessionAutoConfigurationRedisTests extends AbstractSessionAutoConfiguratio
void redisSessionWithCustomConfigureRedisActionBean() { void redisSessionWithCustomConfigureRedisActionBean() {
this.contextRunner.withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class)) this.contextRunner.withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class))
.withUserConfiguration(MaxEntriesRedisAction.class) .withUserConfiguration(MaxEntriesRedisAction.class)
.withPropertyValues("spring.redis.host=" + redis.getHost(), .withPropertyValues("spring.data.redis.host=" + redis.getHost(),
"spring.redis.port=" + redis.getFirstMappedPort()) "spring.data.redis.port=" + redis.getFirstMappedPort())
.run(validateStrategy(MaxEntriesRedisAction.class, entry("set-max-intset-entries", "1024"))); .run(validateStrategy(MaxEntriesRedisAction.class, entry("set-max-intset-entries", "1024")));
} }

@ -685,7 +685,7 @@ with the `key` listed in the following table:
| Checks that a mail server is up. | Checks that a mail server is up.
| `mongo` | `mongo`
| {spring-boot-actuator-module-code}/mongo/MongoHealthIndicator.java[`MongoHealthIndicator`] | {spring-boot-actuator-module-code}/data/mongo/MongoHealthIndicator.java[`MongoHealthIndicator`]
| Checks that a Mongo database is up. | Checks that a Mongo database is up.
| `neo4j` | `neo4j`
@ -701,7 +701,7 @@ with the `key` listed in the following table:
| Checks that a Rabbit server is up. | Checks that a Rabbit server is up.
| `redis` | `redis`
| {spring-boot-actuator-module-code}/redis/RedisHealthIndicator.java[`RedisHealthIndicator`] | {spring-boot-actuator-module-code}/data/redis/RedisHealthIndicator.java[`RedisHealthIndicator`]
| Checks that a Redis server is up. | Checks that a Redis server is up.
|=== |===
@ -833,11 +833,11 @@ When appropriate, Spring Boot auto-configures the following `ReactiveHealthIndic
| Checks that a Couchbase cluster is up. | Checks that a Couchbase cluster is up.
| `elasticsearch` | `elasticsearch`
| {spring-boot-actuator-module-code}/elasticsearch/ElasticsearchReactiveHealthIndicator.java[`ElasticsearchReactiveHealthIndicator`] | {spring-boot-actuator-module-code}/data/elasticsearch/ElasticsearchReactiveHealthIndicator.java[`ElasticsearchReactiveHealthIndicator`]
| Checks that an Elasticsearch cluster is up. | Checks that an Elasticsearch cluster is up.
| `mongo` | `mongo`
| {spring-boot-actuator-module-code}/mongo/MongoReactiveHealthIndicator.java[`MongoReactiveHealthIndicator`] | {spring-boot-actuator-module-code}/data/mongo/MongoReactiveHealthIndicator.java[`MongoReactiveHealthIndicator`]
| Checks that a Mongo database is up. | Checks that a Mongo database is up.
| `neo4j` | `neo4j`
@ -845,7 +845,7 @@ When appropriate, Spring Boot auto-configures the following `ReactiveHealthIndic
| Checks that a Neo4j database is up. | Checks that a Neo4j database is up.
| `redis` | `redis`
| {spring-boot-actuator-module-code}/redis/RedisReactiveHealthIndicator.java[`RedisReactiveHealthIndicator`] | {spring-boot-actuator-module-code}/data/redis/RedisReactiveHealthIndicator.java[`RedisReactiveHealthIndicator`]
| Checks that a Redis server is up. | Checks that a Redis server is up.
|=== |===

@ -326,13 +326,12 @@ There is a `spring-boot-starter-data-cassandra` "`Starter`" for collecting the d
[[data.nosql.cassandra.connecting]] [[data.nosql.cassandra.connecting]]
==== Connecting to Cassandra ==== Connecting to Cassandra
You can inject an auto-configured `CassandraTemplate` or a Cassandra `CqlSession` instance as you would with any other Spring Bean. You can inject an auto-configured `CassandraTemplate` or a Cassandra `CqlSession` instance as you would with any other Spring Bean.
The `spring.data.cassandra.*` properties can be used to customize the connection. The `spring.cassandra.*` properties can be used to customize the connection.
Generally, you provide `keyspace-name` and `contact-points` as well the local datacenter name, as shown in the following example: Generally, you provide `keyspace-name` and `contact-points` as well the local datacenter name, as shown in the following example:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks] [source,yaml,indent=0,subs="verbatim",configprops,configblocks]
---- ----
spring: spring:
data:
cassandra: cassandra:
keyspace-name: "mykeyspace" keyspace-name: "mykeyspace"
contact-points: "cassandrahost1:9042,cassandrahost2:9042" contact-points: "cassandrahost1:9042,cassandrahost2:9042"
@ -344,7 +343,6 @@ If the port is the same for all your contact points you can use a shortcut and o
[source,yaml,indent=0,subs="verbatim",configprops,configblocks] [source,yaml,indent=0,subs="verbatim",configprops,configblocks]
---- ----
spring: spring:
data:
cassandra: cassandra:
keyspace-name: "mykeyspace" keyspace-name: "mykeyspace"
contact-points: "cassandrahost1,cassandrahost2" contact-points: "cassandrahost1,cassandrahost2"
@ -352,14 +350,14 @@ If the port is the same for all your contact points you can use a shortcut and o
---- ----
TIP: Those two examples are identical as the port default to `9042`. TIP: Those two examples are identical as the port default to `9042`.
If you need to configure the port, use `spring.data.cassandra.port`. If you need to configure the port, use `spring.cassandra.port`.
[NOTE] [NOTE]
==== ====
The Cassandra driver has its own configuration infrastructure that loads an `application.conf` at the root of the classpath. The Cassandra driver has its own configuration infrastructure that loads an `application.conf` at the root of the classpath.
Spring Boot does not look for such a file by default but can load one using `spring.data.cassandra.config`. Spring Boot does not look for such a file by default but can load one using `spring.cassandra.config`.
If a property is both present in `+spring.data.cassandra.*+` and the configuration file, the value in `+spring.data.cassandra.*+` takes precedence. If a property is both present in `+spring.cassandra.*+` and the configuration file, the value in `+spring.cassandra.*+` takes precedence.
For more advanced driver customizations, you can register an arbitrary number of beans that implement `DriverConfigLoaderBuilderCustomizer`. For more advanced driver customizations, you can register an arbitrary number of beans that implement `DriverConfigLoaderBuilderCustomizer`.
The `CqlSession` can be customized with a bean of type `CqlSessionBuilderCustomizer`. The `CqlSession` can be customized with a bean of type `CqlSessionBuilderCustomizer`.

@ -43,10 +43,9 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* *
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
@DataCassandraTest(properties = { "spring.data.cassandra.local-datacenter=datacenter1", @DataCassandraTest(properties = { "spring.cassandra.local-datacenter=datacenter1",
"spring.data.cassandra.schema-action=create-if-not-exists", "spring.cassandra.schema-action=create-if-not-exists", "spring.cassandra.connection.connect-timeout=60s",
"spring.data.cassandra.connection.connect-timeout=60s", "spring.cassandra.connection.init-query-timeout=60s", "spring.cassandra.request.timeout=60s" })
"spring.data.cassandra.connection.init-query-timeout=60s", "spring.data.cassandra.request.timeout=60s" })
@Testcontainers(disabledWithoutDocker = true) @Testcontainers(disabledWithoutDocker = true)
class DataCassandraTestIntegrationTests { class DataCassandraTestIntegrationTests {
@ -55,7 +54,7 @@ class DataCassandraTestIntegrationTests {
@DynamicPropertySource @DynamicPropertySource
static void cassandraProperties(DynamicPropertyRegistry registry) { static void cassandraProperties(DynamicPropertyRegistry registry) {
registry.add("spring.data.cassandra.contact-points", registry.add("spring.cassandra.contact-points",
() -> cassandra.getHost() + ":" + cassandra.getFirstMappedPort()); () -> cassandra.getHost() + ":" + cassandra.getFirstMappedPort());
} }

@ -42,11 +42,10 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Artsiom Yudovin * @author Artsiom Yudovin
*/ */
@DataCassandraTest(includeFilters = @Filter(Service.class), @DataCassandraTest(includeFilters = @Filter(Service.class),
properties = { "spring.data.cassandra.local-datacenter=datacenter1", properties = { "spring.cassandra.local-datacenter=datacenter1",
"spring.data.cassandra.schema-action=create-if-not-exists", "spring.cassandra.schema-action=create-if-not-exists",
"spring.data.cassandra.connection.connect-timeout=60s", "spring.cassandra.connection.connect-timeout=60s", "spring.cassandra.connection.init-query-timeout=60s",
"spring.data.cassandra.connection.init-query-timeout=60s", "spring.cassandra.request.timeout=60s" })
"spring.data.cassandra.request.timeout=60s" })
@Testcontainers(disabledWithoutDocker = true) @Testcontainers(disabledWithoutDocker = true)
class DataCassandraTestWithIncludeFilterIntegrationTests { class DataCassandraTestWithIncludeFilterIntegrationTests {
@ -55,7 +54,7 @@ class DataCassandraTestWithIncludeFilterIntegrationTests {
@DynamicPropertySource @DynamicPropertySource
static void cassandraProperties(DynamicPropertyRegistry registry) { static void cassandraProperties(DynamicPropertyRegistry registry) {
registry.add("spring.data.cassandra.contact-points", registry.add("spring.cassandra.contact-points",
() -> cassandra.getHost() + ":" + cassandra.getFirstMappedPort()); () -> cassandra.getHost() + ":" + cassandra.getFirstMappedPort());
} }

@ -60,8 +60,8 @@ class DataRedisTestIntegrationTests {
@DynamicPropertySource @DynamicPropertySource
static void redisProperties(DynamicPropertyRegistry registry) { static void redisProperties(DynamicPropertyRegistry registry) {
registry.add("spring.redis.host", redis::getHost); registry.add("spring.data.redis.host", redis::getHost);
registry.add("spring.redis.port", redis::getFirstMappedPort); registry.add("spring.data.redis.port", redis::getFirstMappedPort);
} }
@Test @Test

@ -46,8 +46,8 @@ class DataRedisTestPropertiesIntegrationTests {
@DynamicPropertySource @DynamicPropertySource
static void redisProperties(DynamicPropertyRegistry registry) { static void redisProperties(DynamicPropertyRegistry registry) {
registry.add("spring.redis.host", redis::getHost); registry.add("spring.data.redis.host", redis::getHost);
registry.add("spring.redis.port", redis::getFirstMappedPort); registry.add("spring.data.redis.port", redis::getFirstMappedPort);
} }
@Test @Test

@ -53,8 +53,8 @@ class DataRedisTestReactiveIntegrationTests {
@DynamicPropertySource @DynamicPropertySource
static void redisProperties(DynamicPropertyRegistry registry) { static void redisProperties(DynamicPropertyRegistry registry) {
registry.add("spring.redis.host", redis::getHost); registry.add("spring.data.redis.host", redis::getHost);
registry.add("spring.redis.port", redis::getFirstMappedPort); registry.add("spring.data.redis.port", redis::getFirstMappedPort);
} }
@Test @Test

@ -49,8 +49,8 @@ class DataRedisTestWithIncludeFilterIntegrationTests {
@DynamicPropertySource @DynamicPropertySource
static void redisProperties(DynamicPropertyRegistry registry) { static void redisProperties(DynamicPropertyRegistry registry) {
registry.add("spring.redis.host", redis::getHost); registry.add("spring.data.redis.host", redis::getHost);
registry.add("spring.redis.port", redis::getFirstMappedPort); registry.add("spring.data.redis.port", redis::getFirstMappedPort);
} }
@Test @Test

@ -56,8 +56,8 @@ public class SampleSessionRedisApplicationTests {
@DynamicPropertySource @DynamicPropertySource
static void applicationProperties(DynamicPropertyRegistry registry) { static void applicationProperties(DynamicPropertyRegistry registry) {
registry.add("spring.redis.host", redis::getHost); registry.add("spring.data.redis.host", redis::getHost);
registry.add("spring.redis.port", redis::getFirstMappedPort); registry.add("spring.data.redis.port", redis::getFirstMappedPort);
} }
@Test @Test

@ -56,8 +56,8 @@ class SampleSessionWebFluxRedisApplicationTests {
@DynamicPropertySource @DynamicPropertySource
static void applicationProperties(DynamicPropertyRegistry registry) { static void applicationProperties(DynamicPropertyRegistry registry) {
registry.add("spring.redis.host", redis::getHost); registry.add("spring.data.redis.host", redis::getHost);
registry.add("spring.redis.port", redis::getFirstMappedPort); registry.add("spring.data.redis.port", redis::getFirstMappedPort);
} }
@Test @Test

Loading…
Cancel
Save