Reputation: 1128
I am using the GraphRepository of the spring-data-neo4j(3.3.0.RELEASE) to do DB operations on Neo4J DB. And using the below configurations to establish the connect to the Neo4J DB.
<neo4j:config base-package="com.em.alert.model" graphDatabaseService="graphDatabaseService"/>
<bean id="graphDatabaseService" class="org.springframework.data.neo4j.rest.SpringCypherRestGraphDatabase">
<constructor-arg value="${alert.neo4j.url}" index="0"/>
</bean>
But when I finishes all the operations along with closing the Spring ApplicationContext, the DB connection with Neo4J DB is not getting closed.
Can anyone help me to figure out the way to close the DB connection to the Neo4J DB.
Thanks in advance.
Upvotes: 2
Views: 244
Reputation: 41676
add destroy-method="shutdown"
to your bean
<neo4j:config base-package="com.em.alert.model" graphDatabaseService="graphDatabaseService"/>
<bean id="graphDatabaseService" class="org.springframework.data.neo4j.rest.SpringCypherRestGraphDatabase" destroy-method="shutdown">
<constructor-arg value="${alert.neo4j.url}" index="0"/>
</bean>
Upvotes: 2