我试图将一些Neo4J Java代码转换为2.2+,代码运行带有Web前端的嵌入式Neo4J服务器.
// configure embedded DB,
// but this doesn't start a server at port 12345 ?
final GraphDatabaseService db = new GraphDatabaseFactory()
.newEmbeddedDatabaseBuilder("/path/to/db")
.setConfig(ServerSettings.webserver_address, "localhost")
.setConfig(ServerSettings.webserver_port, 12345)
.newGraphDatabase();
// add shutdown hook
Runtime.getRuntime().addShutdownHook(new Thread(){
@Override public void run() {
graphDb.shutdown();
}
});
Run Code Online (Sandbox Code Playgroud)
启动服务器的已弃用代码读取:
final GraphDatabaseAPI api = (GraphDatabaseAPI)db;
final ServerConfigurator c = new ServerConfigurator(api);
c.configuration().addProperty(
Configurator.WEBSERVER_ADDRESS_PROPERTY_KEY, "localhost");
c.configuration().addProperty(
Configurator.WEBSERVER_PORT_PROPERTY_KEY, 12345);
new WrappingNeoServerBootstrapper(api, c).start();
Run Code Online (Sandbox Code Playgroud)
如果不这样做,则无法启动服务器.我不清楚如何在不使用已弃用的方法的情况下运行嵌入式服务器.有什么想法吗?
更新:
所以确实正确的答案似乎是:改变你的架构.
不应再使用嵌入式服务器,而应使用服务器和RESTful API.对于需要Java API的位,您可以编写非托管扩展(请参阅docs).
这是一个扩展名为https://github.com/histograph/neo4j-plugin的简单示例
谢谢!
我想从命令行搜索并安装clojure依赖项.
是否存在可以的工具/ leiningen命令/ lein change脚本?/ ...
project.clj以包含依赖项(最新版本)很多npm install --save(--save-dev)和npm search那些熟悉npm(JS/Node包管理器)的人.
(也许boot可以提供更像npm的工作流程?)