【发布时间】:2015-03-16 06:06:51
【问题描述】:
有谁知道如何在 Spring Boot 应用程序中获取 SpatialRepository@Autowiring 吗?我已将附加依赖项放在我的类路径中
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-spatial</artifactId>
<version>0.9</version>
</dependency>
具有以下配置选项
@SuppressWarnings("unused")
@Configuration
@EnableAutoConfiguration
@EnableTransactionManagement
@EnableNeo4jRepositories(basePackages = {"com.eanda.prototype", "test.com.eanda.prototype"})
@ComponentScan({"com.erranda.prototype", "org.springframework.data.neo4j"})
我都试过了,但没有用。我的域类是这样的:
public interface ErrandRepository extends GraphRepository<Errand>, SpatialRepository<Errand> {}
在空间存储库上运行查询时出现以下异常
java.lang.IllegalArgumentException: No index provider 'spatial' found. Maybe the intended provider (or one more of its dependencies) aren't on the classpath or it failed to load.
【问题讨论】:
-
你能把你的
SpatialRepositorye.g.public interface PersonRepository extends SpatialRepository<Person> {}。你的 pom 中有spring-data-neo4j吗?这里有一个非常容易学习的教程:spring.io/guides/gs/accessing-data-neo4j 这对我有用。 -
@Andreas 我的项目使用了运行良好的 GraphRepository。但是空间回购现在在问题中创建了例外。这是一个相关的问题,stackoverflow.com/questions/19198275/… 但该解决方案不能解决我的问题。
-
@jjaderberg 有什么想法吗?
-
您的异常看起来确实像 spartial 索引的 jar 不在类路径上。你把插件添加到你的neo4j服务器了吗github.com/neo4j-contrib/…
-
我使用的是嵌入式数据库。
标签: spring spring-data spring-boot spring-data-neo4j neo4j-spatial