我正在使用Spring-Data-Cassandra 1.2.2。我正在使用XML配置如下。我读到默认的ConsistencyLevel是ONE,我想将它设置为QUORUM。如何在XML中配置它? 如果需要,我可以升级我的Spring-Data-Cassandra版本。
<?xml version='1.0'?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cassandra="http://www.springframework.org/schema/data/cassandra"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/cql http://www.springframework.org/schema/cql/spring-cql.xsd
http://www.springframework.org/schema/data/cassandra http://www.springframework.org/schema/data/cassandra/spring-cassandra.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- Loads the properties into the Spring Context and uses them to fill in placeholders in the bean definitions -->
<context:property-placeholder location="classpath:resources.properties" />
<!-- REQUIRED: The Cassandra Cluster -->
<cassandra:cluster contact-points="${cassandra.contactpoints}" port="${cassandra.port}" />
<!-- REQUIRED: The Cassandra Session, built from the Cluster, and attaching to a keyspace -->
<cassandra:session keyspace-name="${cassandra.keyspace}" schema-action="CREATE" />
<!-- REQUIRED: The Default Cassandra Mapping Context used by CassandraConverter -->
<cassandra:mapping />
<!-- REQUIRED: The Default Cassandra Converter used by CassandraTemplate -->
<cassandra:converter />
<!-- REQUIRED: The Cassandra Template is the building block of all Spring Data Cassandra -->
<cassandra:template />
<!-- OPTIONAL: If you are using Spring Data Cassandra Repositories, add your base packages to scan here -->
<cassandra:repositories base-package="com.my.package.cassandrarepository" />
</beans>
答案 0 :(得分:0)
似乎JavaConfig是唯一的解决方案。在我的项目中,从1.2.2升级到1.5被证明是其他spring-data(mongo&amp; JPA)依赖项的一个复杂的cos。所以我在1.2.2版本中使用了以下配置:Corodva build android