简体   繁体   English

Spring boot jpa + cassandra + mysql

[英]Spring boot jpa + cassandra + mysql

I want to use both cassandra and MySQL in my project (Some objects will be saved in cassandra, some other will be save in MySQL. My issue is how to config it. 我想在我的项目中使用cassandra和MySQL(有些对象将保存在cassandra中,其他一些将保存在MySQL中。我的问题是如何配置它。

Currently, my configuration is 目前,我的配置是

@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 {}

But, I can not @Autowired an Repository from MySQL dialect, as well as can not @Autowired SessionFactory. 但是,我不能@Autowired MySQL方言的存储库,以及不能@Autowired SessionFactory。 Please help me to config them. 请帮我配置它们。

Could you show more error log. 你能显示更多错误日志吗? But i think you should separate them into two different sub-projects. 但我认为你应该将它们分成两个不同的子项目。 It can make your code more clean and maintainable. 它可以使您的代码更加干净和可维护。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM