title: ClassNotFoundException org.neo4j.graphdb.factory.GraphDatabaseFactory
body: <p>I'm trying to test my API project. I'm having this issue :</p>
  
  <pre><code>Caused by: java.lang.ClassNotFoundException: org.neo4j.graphdb.factory.GraphDatabaseFactory
      at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
      at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
      at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
      ... 147 more
  </code></pre>
  
  <p>Anyone has faced the issue ?</p>
  
  <p>From the question <a href="https://stackoverflow.com/questions/53723303/springboot-beandefinitionoverrideexception-invalid-bean-definition">SpringBoot - BeanDefinitionOverrideException: Invalid bean definition</a>
  I know I need to activate bean overriding so I have activated it.</p>
  
  <pre><code>@RunWith(SpringRunner.class)
  @SpringBootTest(properties = "spring.main.allow-bean-definition-overriding=true")
  @ContextConfiguration(classes = { TestConfiguration.class})
  @ActiveProfiles(profiles = "test")
  public class EmployeeRepositoryTest {
  
      @Autowired
      private EmployeeService employeeService;
  
      @Test
      public void testIt() {
          Employee user = new Employee(10, "Test");
  
          employeeService.addEmployee(user);
  
          Iterable&lt;Employee&gt; allEmp = employeeService.findAll();
  
          assertThat(allEmp).hasSize(1);
      }
  }
  </code></pre>
  
  <p>Here is my configuration class :</p>
  
  <pre><code>@Configuration
  @EnableTransactionManagement
  @ComponentScan(basePackages = { "com.neo4j.interview.api" })
  @EnableNeo4jRepositories(basePackages = "com.neo4j.interview.api.repository")
  @Profile({ "embedded", "test" })
  public class TestConfiguration {
  
      @Bean
      public org.neo4j.ogm.config.Configuration getConfiguration() {
          org.neo4j.ogm.config.Configuration config = new Builder().build();
          return config;
      }
  
      @Bean()
      public SessionFactory sessionFactory() {
          return new SessionFactory(getConfiguration(), "com.neo4j.interview.api.domain");
      }
  
      @Bean
      public Neo4jTransactionManager transactionManager() {
          return new Neo4jTransactionManager(sessionFactory());
      }
  }
  </code></pre>
  
  <p>Here is my pom.xml :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.2.5.RELEASE&lt;/version&gt;
          &lt;relativePath /&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
      &lt;groupId&gt;com.neo4j.interview.api&lt;/groupId&gt;
      &lt;artifactId&gt;neo4jtestapi&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;neo4jtestapi&lt;/name&gt;
      &lt;description&gt;Neo4j test project API&lt;/description&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
          &lt;java.version&gt;11&lt;/java.version&gt;
          &lt;neo4j.version&gt;4.0.2&lt;/neo4j.version&gt;
          &lt;log4j.version&gt;1.2.17&lt;/log4j.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web-services&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-configuration-processor&lt;/artifactId&gt;
              &lt;optional&gt;true&lt;/optional&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
              &lt;artifactId&gt;lombok&lt;/artifactId&gt;
              &lt;optional&gt;true&lt;/optional&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.junit.vintage&lt;/groupId&gt;
                      &lt;artifactId&gt;junit-vintage-engine&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.restdocs&lt;/groupId&gt;
              &lt;artifactId&gt;spring-restdocs-mockmvc&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-neo4j&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-aop&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.neo4j&lt;/groupId&gt;
              &lt;artifactId&gt;neo4j-bolt&lt;/artifactId&gt;
              &lt;version&gt;${neo4j.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.neo4j&lt;/groupId&gt;
              &lt;artifactId&gt;neo4j-dbms&lt;/artifactId&gt;
              &lt;version&gt;${neo4j.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.neo4j&lt;/groupId&gt;
              &lt;artifactId&gt;neo4j&lt;/artifactId&gt;
              &lt;version&gt;${neo4j.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.neo4j&lt;/groupId&gt;
              &lt;artifactId&gt;neo4j-graphdb-api&lt;/artifactId&gt;
              &lt;version&gt;${neo4j.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.neo4j&lt;/groupId&gt;
              &lt;artifactId&gt;neo4j-ogm-embedded-driver&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.asciidoctor&lt;/groupId&gt;
                  &lt;artifactId&gt;asciidoctor-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;1.5.8&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;generate-docs&lt;/id&gt;
                          &lt;phase&gt;prepare-package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;process-asciidoc&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;backend&gt;html&lt;/backend&gt;
                              &lt;doctype&gt;book&lt;/doctype&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
                  &lt;dependencies&gt;
                      &lt;dependency&gt;
                          &lt;groupId&gt;org.springframework.restdocs&lt;/groupId&gt;
                          &lt;artifactId&gt;spring-restdocs-asciidoctor&lt;/artifactId&gt;
                          &lt;version&gt;${spring-restdocs.version}&lt;/version&gt;
                      &lt;/dependency&gt;
                  &lt;/dependencies&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;mainClass&gt;com.neo4j.interview.api.Neo4jtestApiApplication&lt;/mainClass&gt;
                  &lt;/configuration&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;repackage&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>Update:
  If I remove overriding line, employeeService is null in EmployeeRepositoryTest</p>