Spring Data Neo4j-如何使WrappingNeoServerBootstrapper收听0.0.0.0 [英] Spring Data Neo4j - How to get WrappingNeoServerBootstrapper to listen on 0.0.0.0
问题描述
试图获取WrappingNeoServerBootstrapper以在0.0.0.0而不是localhost上启动Neo4j WebAdmin接口.尝试将所有指定JAVA_OPTS的形式(例如-Dorg.neo4j.server.webserver.address = 0.0.0.0)传递给WrappingNeoServerBootstrapper的第二个构造函数参数中的我自己的Config-但它始终在localhost上侦听.希望有人有解决方案或示例.这是我的Spring配置-回到基础.预先感谢.
Been trying to get the WrappingNeoServerBootstrapper to start the Neo4j WebAdmin interface on 0.0.0.0 instead of localhost. Tried everything form specifying JAVA_OPTS (E.g., -Dorg.neo4j.server.webserver.address=0.0.0.0), to passing my own Config in the second constructor argument of WrappingNeoServerBootstrapper - but it always listens on localhost. Hoping someone has a solutions or an example. Here is my Spring config - back to basics. Thanks in advance.
<bean id="graphDatabaseService" class="org.neo4j.kernel.EmbeddedGraphDatabase" destroy-method="shutdown">
<constructor-arg index="0" value="${com.calendr.neo4jDataDir}"/>
<constructor-arg index="1">
<map>
<entry key="allow_store_upgrade" value="true"/>
<entry key="enable_remote_shell" value="true"/>
</map>
</constructor-arg>
</bean>
<bean id="serverWrapper" class="org.neo4j.server.WrappingNeoServerBootstrapper" init-method="start" destroy-method="stop">
<constructor-arg ref="graphDatabaseService"/>
</bean>
推荐答案
在阅读了Neo代码后,我发现了它.这是我最后的工作配置.
I figured it out after reading through the Neo code. Here is my final working config.
<neo4j:config graphDatabaseService="graphDatabaseService"/>
<bean id="graphDatabaseService" class="org.neo4j.kernel.EmbeddedGraphDatabase" destroy-method="shutdown">
<constructor-arg index="0" value="${com.mycompany.neo4jDataDir}"/>
<constructor-arg index="1">
<map>
<entry key="allow_store_upgrade" value="true"/>
<entry key="enable_remote_shell" value="true"/>
</map>
</constructor-arg>
</bean>
<bean id="config" class="com.mycompany.Neo4jServerConfig">
<constructor-arg>
<map>
<entry key="org.neo4j.server.webserver.address" value="0.0.0.0"/>
</map>
</constructor-arg>
</bean>
<bean id="serverWrapper" class="org.neo4j.server.WrappingNeoServerBootstrapper" init-method="start" destroy-method="stop">
<constructor-arg index="0" ref="graphDatabaseService"/>
<constructor-arg index="1" ref="config"/>
</bean>
这是配置类:
public class Neo4jServerConfig implements Configurator {
private Configuration config;
public Ne4jServerConfig(Map<String, String> config) {
this.config = new MapConfiguration(config);
}
@Override
public Configuration configuration() {
return config;
}
@Override
public Map<String, String> getDatabaseTuningProperties() {
return null;
}
@Override
public Set<ThirdPartyJaxRsPackage> getThirdpartyJaxRsClasses() {
return new HashSet<>();
}
}
这篇关于Spring Data Neo4j-如何使WrappingNeoServerBootstrapper收听0.0.0.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!