1

最初に、なぜ異なるキースペースを使用したいのですか? JUnit Test を書きたいのですが、テスト用に別のキースペースが必要です。Spring MVC を使用しています。そして、春に自動配線された hectorTemplate を使用します。

<!--  cassandra configuration -->
    <bean id="cassandraHostConfigurator" class="me.prettyprint.cassandra.service.CassandraHostConfigurator">
        <constructor-arg value="${cassandra.url}" />
    </bean>

    <bean id="cluster" class="me.prettyprint.cassandra.service.ThriftCluster">
        <constructor-arg value="${cassandra.cluster}" />
        <constructor-arg ref="cassandraHostConfigurator" />
    </bean>

    <bean id="consistencyLevelPolicy" class="me.prettyprint.cassandra.model.ConfigurableConsistencyLevel">
       <property name="defaultReadConsistencyLevel" value="${cassandra.defaultReadConsistencyLevel}"></property>
       <property name="defaultWriteConsistencyLevel" value="${cassandra.defaultWriteConsistencyLevel}"></property>
    </bean>

    <bean id="keyspace" class="me.prettyprint.hector.api.factory.HFactory" factory-method="createKeyspace">
        <constructor-arg value="${cassandra.keyspace}" />
        <constructor-arg ref="cluster" />
        <constructor-arg ref="consistencyLevelPolicy" />
    </bean>

    <bean id="hectorTemplate" class="me.prettyprint.cassandra.service.spring.HectorTemplateImpl">
        <property name="cluster" ref="cluster" />
        <property name="keyspace" ref="keyspace" />
        <property name="replicationStrategyClass" value="org.apache.cassandra.locator.SimpleStrategy" />
        <property name="replicationFactor" value="1" />
    </bean>

では、別のキースペースを追加するにはどうすればよいですか? 助けてくれてありがとう.(nn)!!!!!

4

1 に答える 1