title: Spring Boot: Configuration Scan missing classes due to "weird" setup
body: <p>We setup an ETL project in a sort of messy way just to get a job done:</p>
  
  <p>This project has dependencies on several other spring projects, so we included those projects as dependencies. These projects contain their own @Configuration classes that could cause conflicts. I'm in a state now where I setup a Dynamic Repository in my ETL project but it is not being autowired, throwing an error:</p>
  
  <blockquote>
    <p>constructor in com.myetl.service.impl.ErrorServiceImpl required a bean of type 'com.myetl.repository.ProjectErrorRepository' that could not be found.</p>
  </blockquote>
  
  <p>I see earlier in the console when I startup the application that it is treating it as a Redis Repository:</p>
  
  <blockquote>
    <p>RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.myetl.repository.ProjectErrorRepository. If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository.</p>
  </blockquote>
  
  <p>I don't have Redis configuration anywhere in my base project, but it is definitely there in one of my Dependencies.</p>
  
  <p>I tried a few different things but nothing works. For example, using an exclude filter:</p>
  
  <pre><code>@SpringBootApplication(exclude = {DifferentProjectConfiguration.class})
  @ComponentScan(includeFilters =
                 @ComponentScan.Filter(type= FilterType.REGEX,
                                       pattern = "com\\.etl\\..*"),
                 excludeFilters =
                 @ComponentScan.Filter(type=FilterType.ASSIGNABLE_TYPE,
                                       value = {OtherProjectRedisConfiguration.class}))
  public class ProjectsMigrationApplication {
  ...
  </code></pre>
  
  <p>If I comment out the repository the application loads fine, including controllers and service beans. This problem only seems to target the repository which I want to be a MySql JPA repo. Here is the definition of my Repository (I tried it with and without the @Repository annotation):</p>
  
  <pre><code>package com.etl.repository;
  
  import com.etl.domain.ProjectError;
  import org.springframework.data.repository.PagingAndSortingRepository;
  import org.springframework.stereotype.Repository;
  
  public interface ProjectErrorRepository extends PagingAndSortingRepository&lt;ProjectError, Long&gt; {
  
  }
  
  </code></pre>
  
  <pre><code>@Entity
  @Table(name="project_error")
  @Data
  public class ProjectError {
      @Id
      @Column(name = "project_error_id")
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private long id;
  
      @Column
      private String errMsg;
  
      @Column(name = "user_email")
      private String userEmail;
  </code></pre>
  
  <pre><code>@Configuration
  @EnableJpaRepositories(entityManagerFactoryRef = "migrationEntityManagerFactory", basePackageClasses = {
          ProjectError.class}, repositoryBaseClass = ProjectErrorRepository.class)
  public class ProjectMigrationJpaConfig {
  
      @Bean(name = "migrationEntityManagerFactory")
      public LocalContainerEntityManagerFactoryBean migrationEntityManagerFactory(EntityManagerFactoryBuilder builder,
              DataSource dataSource) {
          return builder
                  .dataSource(dataSource)
                  .packages(ProjectError.class)
                  .build();
      }
  
  }
  
  </code></pre>
  
  <p>What is the best way to diagnose this type of error in a labyrinthine project to understand what Spring is doing behind the scenes?</p>