Deprecate Cassandra properties that require a default constructor

Closes gh-14473
pull/11458/merge
Stephane Nicoll 6 years ago
parent 068040e227
commit aaecdfb527

@ -60,6 +60,7 @@ public class CassandraAutoConfiguration {
@Bean
@ConditionalOnMissingBean
@SuppressWarnings("deprecation")
public Cluster cassandraCluster() {
PropertyMapper map = PropertyMapper.get();
CassandraProperties properties = this.properties;

@ -31,6 +31,7 @@ import com.datastax.driver.core.policies.ReconnectionPolicy;
import com.datastax.driver.core.policies.RetryPolicy;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
import org.springframework.boot.convert.DurationUnit;
/**
@ -188,10 +189,13 @@ public class CassandraProperties {
this.compression = compression;
}
@DeprecatedConfigurationProperty(reason = "Implement a ClusterBuilderCustomizer bean instead.")
@Deprecated
public Class<? extends LoadBalancingPolicy> getLoadBalancingPolicy() {
return this.loadBalancingPolicy;
}
@Deprecated
public void setLoadBalancingPolicy(
Class<? extends LoadBalancingPolicy> loadBalancingPolicy) {
this.loadBalancingPolicy = loadBalancingPolicy;
@ -221,19 +225,25 @@ public class CassandraProperties {
this.fetchSize = fetchSize;
}
@DeprecatedConfigurationProperty(reason = "Implement a ClusterBuilderCustomizer bean instead.")
@Deprecated
public Class<? extends ReconnectionPolicy> getReconnectionPolicy() {
return this.reconnectionPolicy;
}
@Deprecated
public void setReconnectionPolicy(
Class<? extends ReconnectionPolicy> reconnectionPolicy) {
this.reconnectionPolicy = reconnectionPolicy;
}
@DeprecatedConfigurationProperty(reason = "Implement a ClusterBuilderCustomizer bean instead.")
@Deprecated
public Class<? extends RetryPolicy> getRetryPolicy() {
return this.retryPolicy;
}
@Deprecated
public void setRetryPolicy(Class<? extends RetryPolicy> retryPolicy) {
this.retryPolicy = retryPolicy;
}

@ -635,7 +635,6 @@ content into your application. Rather, pick only the properties that you need.
spring.data.cassandra.contact-points=localhost # Cluster node addresses.
spring.data.cassandra.fetch-size= # Queries default fetch size.
spring.data.cassandra.keyspace-name= # Keyspace name to use.
spring.data.cassandra.load-balancing-policy= # Class name of the load balancing policy. The class must have a default constructor.
spring.data.cassandra.port= # Port of the Cassandra server.
spring.data.cassandra.password= # Login password of the server.
spring.data.cassandra.pool.heartbeat-interval=30s # Heartbeat interval after which a message is sent on an idle connection to make sure it's still alive. If a duration suffix is not specified, seconds will be used.
@ -643,9 +642,7 @@ content into your application. Rather, pick only the properties that you need.
spring.data.cassandra.pool.max-queue-size=256 # Maximum number of requests that get queued if no connection is available.
spring.data.cassandra.pool.pool-timeout=5000ms # Pool timeout when trying to acquire a connection from a host's pool.
spring.data.cassandra.read-timeout= # Socket option: read time out.
spring.data.cassandra.reconnection-policy= # Class name of the reconnection policy. The class must have a default constructor.
spring.data.cassandra.repositories.type=auto # Type of Cassandra repositories to enable.
spring.data.cassandra.retry-policy= # Class name of the retry policy. The class must have a default constructor.
spring.data.cassandra.serial-consistency-level= # Queries serial consistency level.
spring.data.cassandra.schema-action=none # Schema action to take at startup.
spring.data.cassandra.ssl=false # Enable SSL support.

@ -4578,6 +4578,9 @@ used to customize the connection. Generally, you provide `keyspace-name` and
spring.data.cassandra.contact-points=cassandrahost1,cassandrahost2
----
You can also register an arbitrary number of beans that implement
`ClusterBuilderCustomizer` for more advanced customizations.
The following code listing shows how to inject a Cassandra bean:
[source,java,indent=0]

Loading…
Cancel
Save