如何使用 Spring Boot 在 neo4j 中保存多边形

Hem*_*ema 5 java neo4j spring-data-neo4j neo4j-spatial spring-boot

我无法在我的界面中为 Neo4j 空间插件导入JavaSpatialRepositoryGraphRepositoryJava。

我必须使用neo4j-spatial 插件将多边形数据添加到neo4j 数据库中。为此我使用wkt 格式。但是由于我的 pom.xml 中的版本不匹配,没有导入任何内容。

我曾尝试更改空间插件的版本,但仍然无济于事。我正在使用嵌入式驱动程序。

我正在添加完整的 pom.xml 配置。

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.neo4j</groupId>
<artifactId>Neo4j</artifactId>
<version>0.25.5-neo4j-3.3.5</version>
<packaging>jar</packaging>

<name>Neo4j</name>
<description>Demo project for Spring Boot</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.1.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
       <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-neo4j</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j</artifactId>
        <version>3.3.5</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j-ogm-embedded-driver</artifactId>
        <version>${neo4j-ogm.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j-ogm-bolt-driver</artifactId>
        <version>${neo4j-ogm.version}</version>
    </dependency>
   <dependency>
<groupId>com.vividsolutions</groupId>
<artifactId>jts</artifactId>
<version>1.13</version>
</dependency>
<dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>neo4j-spatial</artifactId>
         <version>0.25.5-neo4j-3.3.5</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)

应用程序属性

spring.data.neo4j.uri=bolt://localhost
spring.data.neo4j.username=neo4j
spring.data.neo4j.password=password
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?

编辑

有了这个gitRepo 示例克隆,也遇到了同样的问题。

编辑:

更新 pom.xml

编辑

@NodeEntity
public class Geofence {

@Id
@GeneratedValue
private Long geofence_id;

private double latitude;

private double longitude;

@Indexed(indexName="GEOFENCE", indexType=IndexType.POINT)
private String wkt;
}
Run Code Online (Sandbox Code Playgroud)

这里也无法导入 @Indexed, indexType=IndexType.POINT

编辑

如果我添加这个依赖,我会得到GraphRepositorySpatialRepository

<dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-neo4j</artifactId>
        <version>3.3.1.RELEASE</version>
     </dependency>
Run Code Online (Sandbox Code Playgroud)

Neo4jRepository在我的 spring boot 项目中不起作用