Spring Data Neo4j连接辅助数据库

时间:2019-06-01 12:22:12

标签: java spring neo4j spring-data

我有一个春季Neo4j服务器,我想为一些功能添加第二个SQL存储库,这些存储库将与Neo4j服务器分开使用。我认为我需要阅读两个DBconfig类,每个数据库一个。我是否有这样的配置文件:

关系:

@Configuration
//not sure this PropertySource is going to be right
//TODO: Create new property Source (HINT: Property file in resources)
@PropertySource({"classpath:persistence-multiple-db.properties"})
@EnableJpaRepositories(
        basePackages = "com.saminahbab.springneoserver.model.relational",
        entityManagerFactoryRef = "CampaignEntityManager",
        transactionManagerRef = "CampaignTransactionManager"
)
public class CampaignConfig { .....}

和neo4j数据库的另一个dbconfig文件:

@Configuration
@EnableNeo4jRepositories(basePackages = "org.neo4j.example.repository")
@EnableTransactionManagement
public class MyConfiguration {

    @Bean
    public SessionFactory sessionFactory() {
        // with domain entity base package(s)
        return new SessionFactory(configuration(), "org.neo4j.example.domain");

......         }

我的问题是,如何将每个配置链接到我的Neo4jRepository和我的CrudRepository这两个不同的存储库?

0 个答案:

没有答案