【发布时间】:2016-12-19 15:45:19
【问题描述】:
如何在同一个 spring-boot 应用程序中使用 spring-data-mongodb 和 spring-data-neo4j?
我可以按照“入门”指南轻松使用其中一种,但是一旦我尝试将 Neo4J 添加到 MongoDB 应用程序中,就会出现运行时错误,例如:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'application': Unsatisfied dependency expressed through field 'repository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bookRepository': Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property findAll found for type MongoBook!
我在https://github.com/afaulconbridge/myspring-mongo-neo 设置了一个最小示例
【问题讨论】:
-
从 spring 数据示例中看到这一点。 github.com/spring-projects/spring-data-examples/tree/master/…。这个示例应该让您了解多个 Spring 数据模块如何协同工作。
-
您是否强制 Spring Data MongoDB 和 Neo4J 扫描相同的包?如果是,您将遇到this error。链接的帖子解释了如何解决该问题。
标签: spring-boot spring-data-mongodb spring-data-neo4j-4