Skip to content

Instantly share code, notes, and snippets.

@sarmbruster
Created August 13, 2013 16:02
Show Gist options
  • Save sarmbruster/6222698 to your computer and use it in GitHub Desktop.
Save sarmbruster/6222698 to your computer and use it in GitHub Desktop.
how to instantiate a HighlyAvailableGraphdatabase via HighlyAvailableGraphDatabaseFactory using Spring for Neo4j 1.9
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">
<util:map id="config">
<entry key="ha.server_id" value="1"/>
<entry key="ha.initial_hosts" value=":5000,:5001,:5002"/>
<!-- put in more config parameters here, http://docs.neo4j.org/chunked/stable/ha-configuration.html -->
</util:map>
<bean id="graphDbFactory" class="org.neo4j.graphdb.factory.HighlyAvailableGraphDatabaseFactory"/>
<bean id="graphDbBuilder" factory-bean="graphDbFactory" factory-method="newHighlyAvailableDatabaseBuilder">
<constructor-arg value="/tmp/neo4j"/>
</bean>
<bean id="graphDbBuilderFinal" factory-bean="graphDbBuilder" factory-method="setConfig">
<constructor-arg ref="config"/>
</bean>
<bean id="graphDatabaseService" factory-bean="graphDbBuilderFinal" factory-method="newGraphDatabase" destroy-method="shutdown" />
</beans>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment