如何配置 Quarkus 以指向非默认名称 Neo4J DB?

How to configure Quarkus to point to a non default name Neo4J DB?

默认配置指向 bolt://localhost:7687,因此指向 Neo4J DB,但使用企业版您可以创建自己的。我们称它为 MyInstance

如何使用插件配置 uri 以指向 MyInstance?

驱动程序连接到 Neo4j 服务器。然后您可以指定要在会话级别使用的数据库,例如:

// imports
import org.neo4j.driver.Driver;
import org.neo4j.driver.GraphDatabase;
import org.neo4j.driver.Session;
import org.neo4j.driver.SessionConfig;

// ... other code
try (Session session = driver.session(SessionConfig.forDatabase("movies"))) {
   session.writeTransaction((tx) -> {
      tx.run("CREATE (n:Movie {name: $name})", Map.of("name", "The Matrix"));
      return null;
   });
}