【问题标题】:SpatialRepository not autowiringSpatialRepository 不自动装配
【发布时间】: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&lt;Person&gt; {}。你的 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


【解决方案1】:

您是否将空间引擎引入现有数据库? 您是否在插件目录中安装了空间扩展? 洛伦佐

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-09
    • 1970-01-01
    • 1970-01-01
    • 2015-09-17
    • 2016-10-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多