|
|
@ -40,6 +40,8 @@ import org.springframework.util.StringUtils;
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @author Julien Dubois
|
|
|
|
* @author Julien Dubois
|
|
|
|
* @author Phillip Webb
|
|
|
|
* @author Phillip Webb
|
|
|
|
|
|
|
|
* @author Eddú Meléndez
|
|
|
|
|
|
|
|
* @author Stephane Nicoll
|
|
|
|
* @since 1.3.0
|
|
|
|
* @since 1.3.0
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Configuration
|
|
|
|
@Configuration
|
|
|
@ -49,12 +51,13 @@ public class CassandraAutoConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|
private final CassandraProperties properties;
|
|
|
|
private final CassandraProperties properties;
|
|
|
|
|
|
|
|
|
|
|
|
private final List<ClusterCustomizer> clusterCustomizers;
|
|
|
|
private final List<ClusterBuilderCustomizer> builderCustomizers;
|
|
|
|
|
|
|
|
|
|
|
|
public CassandraAutoConfiguration(CassandraProperties properties,
|
|
|
|
public CassandraAutoConfiguration(CassandraProperties properties,
|
|
|
|
ObjectProvider<List<ClusterCustomizer>> clusterCustomizersProvider) {
|
|
|
|
ObjectProvider<List<ClusterBuilderCustomizer>> builderCustomizersProvider) {
|
|
|
|
this.properties = properties;
|
|
|
|
this.properties = properties;
|
|
|
|
this.clusterCustomizers = clusterCustomizersProvider.getIfAvailable();
|
|
|
|
this.builderCustomizers = builderCustomizersProvider
|
|
|
|
|
|
|
|
.getIfAvailable();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
@ -90,15 +93,14 @@ public class CassandraAutoConfiguration {
|
|
|
|
String points = properties.getContactPoints();
|
|
|
|
String points = properties.getContactPoints();
|
|
|
|
builder.addContactPoints(StringUtils.commaDelimitedListToStringArray(points));
|
|
|
|
builder.addContactPoints(StringUtils.commaDelimitedListToStringArray(points));
|
|
|
|
|
|
|
|
|
|
|
|
Cluster cluster = builder.build();
|
|
|
|
customize(builder);
|
|
|
|
customize(cluster);
|
|
|
|
return builder.build();
|
|
|
|
return cluster;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void customize(Cluster cluster) {
|
|
|
|
private void customize(Cluster.Builder builder) {
|
|
|
|
if (this.clusterCustomizers != null) {
|
|
|
|
if (this.builderCustomizers != null) {
|
|
|
|
for (ClusterCustomizer customizer : this.clusterCustomizers) {
|
|
|
|
for (ClusterBuilderCustomizer customizer : this.builderCustomizers) {
|
|
|
|
customizer.customize(cluster);
|
|
|
|
customizer.customize(builder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|