Fix type for spring.data.cassandra.contact-points
Closes gh-11354
This commit is contained in:
parent
bf3aa62a58
commit
7566a197b0
|
@ -34,7 +34,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
|
|||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for Cassandra.
|
||||
|
@ -91,8 +90,7 @@ public class CassandraAutoConfiguration {
|
|||
builder.withSSL();
|
||||
}
|
||||
builder.withPoolingOptions(getPoolingOptions());
|
||||
String points = properties.getContactPoints();
|
||||
builder.addContactPoints(StringUtils.commaDelimitedListToStringArray(points));
|
||||
builder.addContactPoints(properties.getContactPoints().toArray(new String[0]));
|
||||
|
||||
customize(builder);
|
||||
return builder.build();
|
||||
|
|
|
@ -18,6 +18,9 @@ package org.springframework.boot.autoconfigure.cassandra;
|
|||
|
||||
import java.time.Duration;
|
||||
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.ProtocolOptions;
|
||||
|
@ -55,7 +58,8 @@ public class CassandraProperties {
|
|||
/**
|
||||
* 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.
|
||||
|
@ -148,14 +152,10 @@ public class CassandraProperties {
|
|||
this.clusterName = clusterName;
|
||||
}
|
||||
|
||||
public String getContactPoints() {
|
||||
public List<String> getContactPoints() {
|
||||
return this.contactPoints;
|
||||
}
|
||||
|
||||
public void setContactPoints(String contactPoints) {
|
||||
this.contactPoints = contactPoints;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return this.port;
|
||||
}
|
||||
|
|
|
@ -90,6 +90,12 @@
|
|||
"name": "spring.datasource.initialization-mode",
|
||||
"defaultValue": "embedded"
|
||||
},
|
||||
{
|
||||
"name": "spring.data.cassandra.contact-points",
|
||||
"defaultValue": [
|
||||
"localhost"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "spring.data.cassandra.compression",
|
||||
"defaultValue": "none"
|
||||
|
|
Loading…
Reference in New Issue