Commit 7566a197 authored by Stephane Nicoll's avatar Stephane Nicoll

Fix type for spring.data.cassandra.contact-points

Closes gh-11354
parent bf3aa62a
...@@ -34,7 +34,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean ...@@ -34,7 +34,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.util.StringUtils;
/** /**
* {@link EnableAutoConfiguration Auto-configuration} for Cassandra. * {@link EnableAutoConfiguration Auto-configuration} for Cassandra.
...@@ -91,8 +90,7 @@ public class CassandraAutoConfiguration { ...@@ -91,8 +90,7 @@ public class CassandraAutoConfiguration {
builder.withSSL(); builder.withSSL();
} }
builder.withPoolingOptions(getPoolingOptions()); builder.withPoolingOptions(getPoolingOptions());
String points = properties.getContactPoints(); builder.addContactPoints(properties.getContactPoints().toArray(new String[0]));
builder.addContactPoints(StringUtils.commaDelimitedListToStringArray(points));
customize(builder); customize(builder);
return builder.build(); return builder.build();
......
...@@ -18,6 +18,9 @@ package org.springframework.boot.autoconfigure.cassandra; ...@@ -18,6 +18,9 @@ package org.springframework.boot.autoconfigure.cassandra;
import java.time.Duration; import java.time.Duration;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.datastax.driver.core.ConsistencyLevel; import com.datastax.driver.core.ConsistencyLevel;
import com.datastax.driver.core.ProtocolOptions; import com.datastax.driver.core.ProtocolOptions;
...@@ -55,7 +58,8 @@ public class CassandraProperties { ...@@ -55,7 +58,8 @@ public class CassandraProperties {
/** /**
* Comma-separated list of cluster node addresses. * Comma-separated list of cluster node addresses.
*/ */
private String contactPoints = "localhost"; private final List<String> contactPoints = new ArrayList<>(
Collections.singleton("localhost"));
/** /**
* Port of the Cassandra server. * Port of the Cassandra server.
...@@ -148,14 +152,10 @@ public class CassandraProperties { ...@@ -148,14 +152,10 @@ public class CassandraProperties {
this.clusterName = clusterName; this.clusterName = clusterName;
} }
public String getContactPoints() { public List<String> getContactPoints() {
return this.contactPoints; return this.contactPoints;
} }
public void setContactPoints(String contactPoints) {
this.contactPoints = contactPoints;
}
public int getPort() { public int getPort() {
return this.port; return this.port;
} }
......
...@@ -90,6 +90,12 @@ ...@@ -90,6 +90,12 @@
"name": "spring.datasource.initialization-mode", "name": "spring.datasource.initialization-mode",
"defaultValue": "embedded" "defaultValue": "embedded"
}, },
{
"name": "spring.data.cassandra.contact-points",
"defaultValue": [
"localhost"
]
},
{ {
"name": "spring.data.cassandra.compression", "name": "spring.data.cassandra.compression",
"defaultValue": "none" "defaultValue": "none"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment