spring - 避免 Spring Boot App 在启动时连接到 Cassandra
问题描述
我有一个 Spring Boot 应用程序,它存储/重试来自 Cassandra DB 的数据。但是如果 Cassandra 不可用,则 Spring 应用程序不会启动。
这是我的代码 - https://github.com/simplyatul/springcassandrajunit
我正在玩 DemoTableRepo.java。如果我注释掉
@RepositoryDefinition(domainClass = DemoTable.class, idClass = String.class)
然后 Spring Boot 应用程序在没有连接到 Cassandra 的情况下启动,但是当 Repo 用于检索/存储调用时,它会引发以下异常
java.lang.IllegalArgumentException: Interface org.simplyatul.cassandrajunit.repository.DemoTableRepo must be annotated with @org.springframework.data.repository.RepositoryDefinition!
如果我保留以下行注释
@RepositoryDefinition(domainClass = DemoTable.class, idClass = String.class)
然后 Spring boot 应用程序尝试在启动时连接到 Cassandra 并且无法启动。
我发现了类似的链接/问题,但提供的解决方案无法正常工作。我错过了什么吗?提前致谢。
解决方案
推荐阅读
- java - 重构后Android Studio无法检测到布局R.id和布局xml无法检测到标签
- sql - 如何查找另一个表上是否存在用户关系
- python - Python中的句子修剪和格式化
- php - 在特定文件中搜索一串文本
- node.js - 如何等待stream.write()的循环结束
- c# - 当我上梯子并创建赢功能时如何改变方向
- angular - 将自定义训练模型加载到 ml5 imageClassifier 时模型无效
- java - 新编码器来了!我需要学习如何修复无法找到或加载主类
- javascript - 基于 url 的活动/折叠类不适用于子菜单
- powerbi - 通过 DAX 在 Power BI 中排名倒数 10%