Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9003873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:46:13+00:00 2026-06-16T00:46:13+00:00

I am using Spring Data Neo4j, have created one application in Spring. I could

  • 0

I am using Spring Data Neo4j, have created one application in Spring. I could run my application with the help of JUnit test cases. But every time I run my test cases it creates a new database in the directory path specified using <neo4j:config storeDirectory="target/neo4j-db"/>. This creates db in the same location where my workspace is present in Eclipse.

I have installed Neo4j debian package in my ubuntu which has by default database in /var/lib/neo4j/data/graph.db. I want my application to use this database instead of creating the one in target/neo4j-db. I tried to replace target/neo4j-db by /var/lib/neo4j/data/graph.db and have given permission to read and write to the database. But it does not work.

What is wrong with this configurations? Am I missing anything?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:46:14+00:00Added an answer on June 16, 2026 at 12:46 am

    To run your JUnit tests against a Neo4j DB you have 3 choices

    • Use the local folder used by Neo4j. For this to work you have to stop the Neo4j server before running your tests. If you are running your tests with SpringJUnit4ClassRunner.class and want to make sure that your changes are not reverted after the changes you have to put a @Rollback(false) on the methods you want. This has to be done because SpringJUnit4ClassRunner.class will rollback all changes done to the DB during the tests.
    • Use a REST approach (and again use the trick with @Rollback(false) for the SpringJUnit4ClassRunner.class). For this to work contrary to the local method you have to have started the Neo4j server before you run your tests. You also have to configure your xml file like this:

      <neo4j:config graphDatabaseService="graphDatabaseService"/>
      <bean id="graphDatabaseService" class="org.springframework.data.neo4j.rest.SpringRestGraphDatabase">
      <constructor-arg value="http://localhost:7474/db/data/" index="0" />
      </bean>

      • And the last option you can use is an Impermanent Graph Database (This is just for info because I doubt that this covers your case). This method will create a temporary DB only for the purpose of running the tests. Everything after the tests are done will be removed. For this to work in doesn’t matter if the Neo4j server is running or not. You just have to add in your xml file these two lines:

      <neo4j:config graphDatabaseService="graphDatabaseService"/>
      <bean id="graphDatabaseService" class="org.neo4j.test.ImpermanentGraphDatabase" destroy-method="shutdown"/>

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Spring data neo4j 2.1.0.BUILD-SNAPSHOT and Neo4j 1.6.1 server. I have a Friendship
I'm using Spring Data, Neo4j and Jackson to serve a JSON API. I have
Whenever I specify a resource using the Spring Data Hadoop namespace, by application throws
I'm using the simple object/graph mapping in Spring Data Neo4j 2.0, where I perform
My application data access layer is built using Spring and EclipseLink and I am
I am using following spring neo4j snapshot dependency in my project, <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-neo4j</artifactId>
Is it possible to fetch Page results when using Spring Data Graph (Neo4J) as
Is it possible to use the WrappingNeoServerBootstrapper with spring-data-neo4j? When using an embedded database
On a Spring project I'm using Spring Data MongoDB, and have 2 classes: public
In one of the projects, we are using Spring Data. Now that the queries

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.