【问题标题】:Spring boot jpa + cassandra + mysql春季启动 jpa + cassandra + mysql
【发布时间】:2015-07-20 08:38:32
【问题描述】:

我想在我的项目中同时使用 cassandra 和 MySQL(一些对象将保存在 cassandra 中,另一些将保存在 MySQL 中。我的问题是如何配置它。

目前,我的配置是

@SpringBootApplication
@EnableCassandraRepositories(basePackages = { "com.example.cassandra.repository" })
@PropertySource(value = { "classpath:cassandra.properties" })
@EnableJpaRepositories(basePackages = { "com.example.mysql.repository" })
@EntityScan(basePackages = "com.example.mysql.model")
@EnableTransactionManagement
public class Application extends AbstractCqlTemplateConfiguration {}

但是,我不能 @Autowired 来自 MySQL 方言的存储库,也不能 @Autowired SessionFactory。请帮我配置它们。

【问题讨论】:

    标签: mysql cassandra spring-boot


    【解决方案1】:

    您能否显示更多错误日志。但我认为你应该将它们分成两个不同的子项目。它可以使您的代码更加干净和可维护。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-01-25
      • 2020-05-17
      • 1970-01-01
      • 2020-08-19
      • 2018-10-28
      • 2018-03-22
      • 2021-01-25
      • 2021-09-20
      相关资源
      最近更新 更多