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