2017-02-13 97 views
1

在我的Spring Boot 1.5.1應用程序中,我將爲Cassandra相關邏輯編寫單元/集成測試。Spring Boot Data嵌入式Cassandra

我加入瞭如下因素Maven的依賴性:

<dependency> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-data-cassandra</artifactId> 
</dependency> 

默認春季啓動Cassandra的配置要與一個真正的卡桑德拉DB服務器連接。

是否有在春/春啓動任何選項,以便配置我的測試中使用嵌入式卡桑德拉服務器?如果是這樣,你能否顯示所需的配置。

回答

2

Spring Boot中沒有嵌入式Apache Cassandra支持,並且沒有計劃。一方面對嵌入式Apache Cassandra的需求不大,另一方面,Apache Cassandra帶有很多與Boot的其他依賴衝突的依賴關係。

看看Cassandra Unit

您也可以使用JUnit測試,可以讓您在Apache Cassandra的版本,運行時的行爲等全面控制時,建立一個自己的測試規則。看看可能的實現:CassandraRule.java

相關問題