欢迎投稿

今日深度:

Spring Boot访问Cassandra,springcassandra

Spring Boot访问Cassandra,springcassandra


Spring Boot 访问Cassandra,大致参考了以下articles, 还是乱七八糟的的,




https://github.com/spring-projects/spring-boot/blob/master/spring-boot-samples/spring-boot-sample-data-cassandra/src/main/java/sample/data/cassandra/CustomerRepository.java


https://github.com/springframeworkguru/spring-boot-cassandra-example/blob/master/src/main/java/guru/springframework/repositories/ProductRepository.java


http://javasampleapproach.com/spring-framework/spring-data/start-spring-data-cassandra-springboot


https://dzone.com/articles/first-steps-to-spring-boot-cassandra




这几篇文章主要使用CrudRepository作为接口访问后台数据,
public interface CustomerRepository extends CrudRepository<Customer, String> {}


但是有一定局限性,只能做简单的cql查询,


如果要使用异步批量查询,如 
ResultSetFuture resultSetFuture = session.executeAsync( statement.bind(vehicleno) )


需要进一步对接口进行 封装, 也可以自定义 Session Bean,进行查询




官方文档, 详细介绍了  spring-data-cassandra的使用:
https://docs.spring.io/spring-data/cassandra/docs/current/reference/html/


http://projects.spring.io/spring-data-cassandra/


看文档过程中发现,不同版本的文档差异还比较大,用的是1.5.10.RELEASE,看的是2.0以上的文档,最终是牛头不对马面,有些功能2.0支持,1.5不支持,例如分页查询,2.0以上已经做了部分支持,1.5文档中完全不支持,就没提分页,运行过程一直报错



文档详细,出于对英文的排斥, 不去看, 绕了不少弯路, 静下来 多看英文文档,总结

www.htsjk.Com true http://www.htsjk.com/cassandra/33718.html NewsArticle Spring Boot访问Cassandra,springcassandra Spring Boot 访问Cassandra,大致参考了以下articles, 还是乱七八糟的的, https://github.com/spring-projects/spring-boot/blob/master/spring-boot-samples/spring-boot-sample-data-cas...
相关文章
    暂无相关文章
评论暂时关闭