2

I'm using spring-data-neo4j 3.1.1.Release with neo4j 2.1.2. I managed to make a spring configuration which is working well but it use the org.neo4j.kernel.EmbeddedGraphDatabase class which is now deprecated. Here is my current configuration :

<bean id="graphDatabaseService" class="org.neo4j.kernel.EmbeddedGraphDatabase"
      destroy-method="shutdown">
    <constructor-arg index="0" value="${graphdir}"/>
    <!-- optionally pass in neo4j-config parameters to the graph database -->
    <constructor-arg index="1">
        <map>
            <entry key="allow_store_upgrade" value="true"/>
        </map>
    </constructor-arg>
    <constructor-arg index="2" ref="defaultGraphDatabaseDependencies" />
</bean>

<bean id="defaultGraphDatabaseDependencies" class="org.neo4j.kernel.DefaultGraphDatabaseDependencies"/>

<neo4j:config graphDatabaseService="graphDatabaseService"  base-package="com.company.domain"/>

How can I write the same kind of spring configuration but using non deprecated classes please ?

1 Answer 1

5

You can use the GraphDatabaseFactory class using spring for this. I've blogged about at http://blog.armbruster-it.de/2013/08/configuring-a-neo4j-graphdatabaseservice-via-spring/

Sign up to request clarification or add additional context in comments.

1 Comment

Nice it works very well, thank you. For other users, just don't forget to add <neo4j:config graphDatabaseService="graphDatabaseService" base-package="your.domain.package"/> to create the neo4jTemplate bean

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.