00 概述
本文总结了Neo4j和Spring/SpringBoot、Alibaba Druid、Dynamic Datasource、Mybatis等整合方案,对相应配置做了详细说明。
01 Spring Data Neo4j 整合方案
添加Neo4j JDBC Driver依赖
<!--Neo4j-Jdbc-Driver-->
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-jdbc-driver</artifactId>
<version>4.0.5</version>
</dependency>
添加application.yml配置
spring:
neo4j:
uri: bolt://localhost:7687 # neo4j+s://xxx.xxx.xxx
authentication:
username: neo4j
password: root
02 Alibaba Druid 整合方案
添加Neo4j JDBC Driver + Alibaba Druid依赖
<!--Neo4j-Jdbc-Driver-->
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-jdbc-driver</artifactId>
<version>4.0.5</version>
</dependency>
<!--Druid-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.2.12</version>
</dependency>
添加application.yml配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: org.neo4j.jdbc.Driver
url: jdbc:neo4j:bolt://localhost:7687 #jdbc:neo4j:neo4j+s://xxx.xxx.xxx
username: neo4j