使用CassandraAutoConfiguration配置Cassandra策略

时间:2017-07-02 14:08:05

标签: spring-boot configuration cassandra

使用CassandraAutoConfiguration时yml配置应如何配置Class<? extends ...>字段,例如reconnectionPolicy: com.datastax.driver.core.policies.ConstantReconnectionPolicy with delayMs = 3000

1 个答案:

答案 0 :(得分:0)

所以似乎提供ClusterBuilderCustomizer自定义属性是唯一的选择。

  @Bean
public ClusterBuilderCustomizer clusterBuilderCustomizer(CassandraBaseProperties properties) {
    return builder -> builder.withReconnectionPolicy(
            new ConstantReconnectionPolicy(properties.getReconnectionPolicyConstantDelayMs()));
}