我正在后端使用 neo4j 和 Spring Data Neo4j (SDN) 开发图形数据库。SDN 允许我使用 HTTP 或 BOLT 连接到 neo4j 并且 SDN 还提供了我只需要提到的所有配置,包括属性和依赖项
#Replace http with bolt
spring:
data:
neo4j:
uri: http://localhost:7474
username: neo4j
password: nopassword
Run Code Online (Sandbox Code Playgroud)
但是,在使用 HTTP 时,我不需要在spring-boot-starter-data-neo4j
正常工作中包含任何其他依赖项
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-neo4j</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
但是为了使用 BOLT,我需要包含一个额外的依赖项
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-neo4j</artifactId>
<exclusions>
<exclusion>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-http-driver</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>4.2.2.BUILD-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-bolt-driver</artifactId>
<version>2.1.2</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
所以让我把我的问题分成更小的问题