The problem I have is that, with a "real" Neo4j configuration defined in the context of the @SpringBootApplication, the context of the test class won't startup because it's got a conflicting config.
The actual errors are:
java.lang.IllegalStateException: Failed to load ApplicationContext
and:
Caused by: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'configuration' defined in com.grahamlea.neo4j_test_app.model.RepositoryTest$Config: Cannot register bean definition [SNIP] defined in com.grahamlea.neo4j_test_app.model.RepositoryTest$Config] for bean 'configuration': There is already [SNIP] defined in com.grahamlea.neo4j_test_app.GraphApiApplication] bound.
Earlier in the week I was playing around with it to try and get it working, I think by giving the beans different names in the @TestConfiguration, and I somehow got it set up so that data was being inserted into the test database but queries were going against my local Neo4j instance.
I'd really appreciate your help in getting it to work with one Neo4j config for the app to use and a different one for tests. My Spring test framework knowledge is a little rusty, so it's totally possible I'm doing something stupid that has a very simple fix.
Sorry that you feel like you're entering a world full of pain. I assure you that's not the case.
Thanks for taking the time to share your setup with us.
The reasons for things falling apart are not that much related to Spring Data Neo4j. It would happen in similar ways with other Spring Data Stores.
I have send you our suggestions as Pull Request with detailed commit messages here:
Please have a close look at each message.
There's nothing I would change or add to the way @DataNeojTest works… It's according to the Spring specs.
Thanks so much for taking the time to help me sort this out. As I find is often the case with Spring, the problem was in not understanding the hidden magic. I'm only just starting to dip my toe in with Neo4j and SDN, so I'm still at the mercy of whatever examples I find on the web, which isn't helped by the fact that most of them use Neo4j 3 and/or JUnit 4. I probably need to invest some time in reading the user guide front to back.
Thanks also for the pointers to resources. I'll check them out. Am I right in understanding that SDN/RX is intended to eventually replace SDN/OGM?