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
This commit is contained in:
Madhura Bhave 2022-05-05 15:45:42 -07:00
parent 1af5994d8f
commit 0991bd3983
65 changed files with 836 additions and 303 deletions

View File

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

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.autoconfigure.elasticsearch;
package org.springframework.boot.actuate.autoconfigure.data.elasticsearch;
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.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.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;

View File

@ -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;

View File

@ -14,14 +14,14 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.autoconfigure.mongo;
package org.springframework.boot.actuate.autoconfigure.data.mongo;
import java.util.Map;
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
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.mongo.MongoHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.autoconfigure.mongo;
package org.springframework.boot.actuate.autoconfigure.data.mongo;
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.ConditionalOnEnabledHealthIndicator;
import org.springframework.boot.actuate.data.mongo.MongoReactiveHealthIndicator;
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.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;

View File

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

View File

@ -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;

View File

@ -14,14 +14,14 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.autoconfigure.redis;
package org.springframework.boot.actuate.autoconfigure.data.redis;
import java.util.Map;
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
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.redis.RedisHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.autoconfigure.redis;
package org.springframework.boot.actuate.autoconfigure.data.redis;
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.ConditionalOnEnabledHealthIndicator;
import org.springframework.boot.actuate.data.redis.RedisReactiveHealthIndicator;
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.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;

View File

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

View File

@ -14,7 +14,7 @@ org.springframework.boot.actuate.autoconfigure.context.properties.ConfigurationP
org.springframework.boot.actuate.autoconfigure.context.ShutdownEndpointAutoConfiguration
org.springframework.boot.actuate.autoconfigure.couchbase.CouchbaseHealthContributorAutoConfiguration
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.endpoint.EndpointAutoConfiguration
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.servlet.WebMvcMetricsAutoConfiguration
org.springframework.boot.actuate.autoconfigure.metrics.web.tomcat.TomcatMetricsAutoConfiguration
org.springframework.boot.actuate.autoconfigure.mongo.MongoHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.mongo.MongoReactiveHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.data.mongo.MongoHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.data.mongo.MongoReactiveHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.neo4j.Neo4jHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.observation.ObservationAutoConfiguration
org.springframework.boot.actuate.autoconfigure.quartz.QuartzEndpointAutoConfiguration
org.springframework.boot.actuate.autoconfigure.r2dbc.ConnectionFactoryHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.redis.RedisHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.redis.RedisReactiveHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.data.redis.RedisHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.data.redis.RedisReactiveHealthContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.scheduling.ScheduledTasksEndpointAutoConfiguration
org.springframework.boot.actuate.autoconfigure.security.reactive.ReactiveManagementWebSecurityAutoConfiguration
org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration

View File

@ -14,12 +14,13 @@
* 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.springframework.boot.actuate.autoconfigure.elasticsearch.ElasticsearchRestHealthContributorAutoConfiguration;
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.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration;

View File

@ -14,12 +14,12 @@
* 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.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.data.mongo.MongoDataAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;

View File

@ -14,13 +14,13 @@
* 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.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
import org.springframework.boot.actuate.mongo.MongoHealthIndicator;
import org.springframework.boot.actuate.mongo.MongoReactiveHealthIndicator;
import org.springframework.boot.actuate.data.mongo.MongoHealthIndicator;
import org.springframework.boot.actuate.data.mongo.MongoReactiveHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
import org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration;

View File

@ -14,13 +14,13 @@
* 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.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
import org.springframework.boot.actuate.redis.RedisHealthIndicator;
import org.springframework.boot.actuate.redis.RedisReactiveHealthIndicator;
import org.springframework.boot.actuate.data.redis.RedisHealthIndicator;
import org.springframework.boot.actuate.data.redis.RedisReactiveHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;

View File

@ -14,13 +14,13 @@
* 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.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
import org.springframework.boot.actuate.redis.RedisHealthIndicator;
import org.springframework.boot.actuate.redis.RedisReactiveHealthIndicator;
import org.springframework.boot.actuate.data.redis.RedisHealthIndicator;
import org.springframework.boot.actuate.data.redis.RedisReactiveHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;

View File

@ -14,7 +14,7 @@
* 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.cluster.HealthResponse;

View File

@ -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;

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.mongo;
package org.springframework.boot.actuate.data.mongo;
import org.bson.Document;

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.mongo;
package org.springframework.boot.actuate.data.mongo;
import org.bson.Document;
import reactor.core.publisher.Mono;

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -15,6 +15,6 @@
*/
/**
* Actuator support for Redis.
* Actuator support for Mongo dependent on Spring Data.
*/
package org.springframework.boot.actuate.redis;
package org.springframework.boot.actuate.data.mongo;

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -15,6 +15,6 @@
*/
/**
* Actuator support for Mongo.
* Actuator support dependent on Spring Data.
*/
package org.springframework.boot.actuate.mongo;
package org.springframework.boot.actuate.data;

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.redis;
package org.springframework.boot.actuate.data.redis;
import java.util.Properties;

View File

@ -14,7 +14,7 @@
* 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.Health;

View File

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

View File

@ -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;

View File

@ -30,6 +30,7 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
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.Status;
import org.springframework.data.elasticsearch.client.elc.ReactiveElasticsearchClient;

View File

@ -49,7 +49,7 @@ class SanitizerTests {
assertThat(sanitizer.sanitize("token", "secret")).isEqualTo("******");
assertThat(sanitizer.sanitize("sometoken", "secret")).isEqualTo("******");
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("VCAP_SERVICES", "{json}")).isEqualTo("******");
@ -68,7 +68,7 @@ class SanitizerTests {
assertThat(sanitizer.sanitize("token", "secret")).isEqualTo("******");
assertThat(sanitizer.sanitize("sometoken", "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("private", "secret")).isEqualTo("secret");
}

View File

@ -56,7 +56,7 @@ class RedisCacheMetricsTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class, CacheAutoConfiguration.class))
.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");
@Test

View File

@ -20,6 +20,7 @@ import com.mongodb.MongoException;
import org.bson.Document;
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.Status;
import org.springframework.data.mongodb.core.MongoTemplate;

View File

@ -22,6 +22,7 @@ import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;
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.Status;
import org.springframework.data.mongodb.core.ReactiveMongoTemplate;

View File

@ -22,6 +22,7 @@ import java.util.Properties;
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.Status;
import org.springframework.data.redis.RedisConnectionFailureException;

View File

@ -23,6 +23,7 @@ import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;
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.Status;
import org.springframework.data.redis.RedisConnectionFailureException;

View File

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

View File

@ -108,7 +108,7 @@ public class CassandraDataAutoConfiguration {
session.setSession(this.session);
session.setConverter(converter);
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;
}

View File

@ -46,7 +46,7 @@ import org.springframework.util.StringUtils;
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ GenericObjectPool.class, JedisConnection.class, Jedis.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 {
JedisConnectionConfiguration(RedisProperties properties,

View File

@ -55,7 +55,7 @@ import org.springframework.util.StringUtils;
*/
@Configuration(proxyBeanMethods = false)
@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 {
LettuceConnectionConfiguration(RedisProperties properties,

View File

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

View File

@ -36,12 +36,12 @@ class RedisUrlSyntaxFailureAnalyzer extends AbstractFailureAnalyzer<RedisUrlSynt
URI uri = new URI(cause.getUrl());
if ("redis-sentinel".equals(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);
}
if ("redis-socket".equals(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);
}
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
}
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) {

View File

@ -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.",
"defaultValue": "org.apache.jasper.servlet.JspServlet"
},
{
"name": "server.servlet.jsp.init-parameters",
"description": "Init parameters used to configure the JSP servlet."
@ -497,6 +496,48 @@
"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",
"type": "java.util.List<java.lang.String>",
@ -616,25 +657,53 @@
},
{
"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",
"defaultValue": "5s"
"defaultValue": "5s",
"deprecation": {
"replacement": "spring.cassandra.connection.connect-timeout",
"level": "error"
}
},
{
"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",
"defaultValue": [
"127.0.0.1:9042"
]
],
"deprecation": {
"replacement": "spring.cassandra.contact-points",
"level": "error"
}
},
{
"name": "spring.data.cassandra.controlconnection.timeout",
"defaultValue": "5s"
"defaultValue": "5s",
"deprecation": {
"replacement": "spring.cassandra.controlconnection.timeout",
"level": "error"
}
},
{
"name": "spring.data.cassandra.jmx-enabled",
@ -645,6 +714,14 @@
"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",
"type": "java.lang.Class",
@ -653,19 +730,43 @@
"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",
"defaultValue": "30s"
"defaultValue": "30s",
"deprecation": {
"replacement": "spring.cassandra.pool.heartbeat-interval",
"level": "error"
}
},
{
"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",
"type": "java.lang.Integer",
"deprecation": {
"replacement": "spring.data.cassandra.request.throttler.max-queue-size",
"replacement": "spring.cassandra.request.throttler.max-queue-size",
"level": "error"
}
},
@ -678,6 +779,14 @@
"level": "error"
}
},
{
"name": "spring.data.cassandra.port",
"type": "java.lang.Integer",
"deprecation": {
"replacement": "spring.cassandra.port",
"level": "error"
}
},
{
"name": "spring.data.cassandra.reconnection-policy",
"type": "java.lang.Class",
@ -692,17 +801,77 @@
"description": "Type of Cassandra repositories to enable.",
"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",
"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",
"defaultValue": "none"
"defaultValue": "none",
"deprecation": {
"replacement": "spring.cassandra.request.throttler.type",
"level": "error"
}
},
{
"name": "spring.data.cassandra.request.timeout",
"defaultValue": "2s"
"defaultValue": "2s",
"deprecation": {
"replacement": "spring.cassandra.request.timeout",
"level": "error"
}
},
{
"name": "spring.data.cassandra.retry-policy",
@ -712,6 +881,38 @@
"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",
"type": "org.springframework.data.couchbase.core.query.Consistency",
@ -1995,6 +2196,258 @@
"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",
"type": "java.lang.Boolean",
@ -2509,7 +2962,7 @@
]
},
{
"name": "spring.data.cassandra.schema-action",
"name": "spring.cassandra.schema-action",
"providers": [
{
"name": "handle-as",

View File

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

View File

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

View File

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

View File

@ -40,21 +40,21 @@ class CassandraPropertiesTests {
@Test
void defaultValuesInManualMetadataAreConsistent() {
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));
// spring.data.cassandra.connection.init-query-timeout
// spring.cassandra.connection.init-query-timeout
assertThat(driverDefaults.get(TypedDriverOption.CONNECTION_INIT_QUERY_TIMEOUT))
.isEqualTo(Duration.ofSeconds(5));
// spring.data.cassandra.request.timeout
// spring.cassandra.request.timeout
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);
// spring.data.cassandra.request.throttler.type
// spring.cassandra.request.throttler.type
assertThat(driverDefaults.get(TypedDriverOption.REQUEST_THROTTLER_CLASS))
.isEqualTo("PassThroughRequestThrottler"); // "none"
// spring.data.cassandra.pool.heartbeat-interval
// spring.cassandra.pool.heartbeat-interval
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));
}

View File

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

View File

@ -110,7 +110,7 @@ class CassandraDataAutoConfigurationTests {
void load(Class<?>... config) {
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)) {
ctx.register(config);
}

View File

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

View File

@ -79,14 +79,14 @@ class CassandraRepositoriesAutoConfigurationTests {
@Test
void enablingReactiveRepositoriesDisablesImperativeRepositories() {
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));
}
@Test
void enablingNoRepositoriesDisablesImperativeRepositories() {
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));
}

View File

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

View File

@ -39,7 +39,7 @@ class RedisAutoConfigurationLettuceWithoutCommonsPool2Tests {
@Test
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);
assertThat(cf.getHostName()).isEqualTo("foo");
assertThat(cf.getClientConfiguration()).isNotInstanceOf(LettucePoolingClientConfiguration.class);

View File

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

View File

@ -54,7 +54,8 @@ class RedisRepositoriesAutoConfigurationTests {
@BeforeEach
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());
}

View File

@ -34,7 +34,7 @@ class RedisUrlSyntaxFailureAnalyzerTests {
RedisUrlSyntaxException exception = new RedisUrlSyntaxException("redis://invalid");
FailureAnalysis analysis = new RedisUrlSyntaxFailureAnalyzer().analyze(exception);
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
@ -54,7 +54,7 @@ class RedisUrlSyntaxFailureAnalyzerTests {
assertThat(analysis.getDescription()).contains(
"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");
assertThat(analysis.getAction()).contains("Use spring.redis.sentinel properties");
assertThat(analysis.getAction()).contains("Use spring.data.redis.sentinel properties");
}
@Test

View File

@ -102,7 +102,7 @@ class ReactiveSessionAutoConfigurationRedisTests extends AbstractSessionAutoConf
@Test
void sessionCookieConfigurationIsAppliedToAutoConfiguredWebSessionIdResolver() {
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.path:/example", "server.reactive.session.cookie.max-age:60",
"server.reactive.session.cookie.http-only:false", "server.reactive.session.cookie.secure:false",

View File

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

View File

@ -685,7 +685,7 @@ with the `key` listed in the following table:
| Checks that a mail server is up.
| `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.
| `neo4j`
@ -701,7 +701,7 @@ with the `key` listed in the following table:
| Checks that a Rabbit server is up.
| `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.
|===
@ -833,11 +833,11 @@ When appropriate, Spring Boot auto-configures the following `ReactiveHealthIndic
| Checks that a Couchbase cluster is up.
| `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.
| `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.
| `neo4j`
@ -845,7 +845,7 @@ When appropriate, Spring Boot auto-configures the following `ReactiveHealthIndic
| Checks that a Neo4j database is up.
| `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.
|===

View File

@ -326,13 +326,12 @@ There is a `spring-boot-starter-data-cassandra` "`Starter`" for collecting the d
[[data.nosql.cassandra.connecting]]
==== Connecting to Cassandra
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:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
spring:
data:
cassandra:
keyspace-name: "mykeyspace"
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]
----
spring:
data:
cassandra:
keyspace-name: "mykeyspace"
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`.
If you need to configure the port, use `spring.data.cassandra.port`.
If you need to configure the port, use `spring.cassandra.port`.
[NOTE]
====
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`.
If a property is both present in `+spring.data.cassandra.*+` and the configuration file, the value in `+spring.data.cassandra.*+` takes precedence.
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.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`.
The `CqlSession` can be customized with a bean of type `CqlSessionBuilderCustomizer`.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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