title: Java Bean not found in configuration with multiple module
body: <p>I having a configuration problem that cause the error below. I know there are a tons of similar problem but I read a lot of answer that stackoverflow suggest with my title but I don't find the right answer yet.</p>
  
  <pre><code>Description:
  
  Field collaborateurJpaRepository in com...infrastructure.persistence.user.UserRepositoryImpl required a bean of type 'com...infrastructure.persistence.jurisdiction.CollaborateurJpaRepository' that could not be found.
  
  Action:
  
  Consider defining a bean of type 'com...infrastructure.persistence.jurisdiction.CollaborateurJpaRepository' in your configuration.
  </code></pre>
  
  <p>Before to give some details of the code, I think it could be nice that I describe you brievly the context.
  I work on a client project which has <strong>8 maven modules (DDD methods)</strong> because at the end of the year 4 modules will be separate in an other server.
  Recently we create a second oracle database so I had to create multiple configuration to refer to the good dataSource. 
  I think the problem is due to bad datasource configuration that block the bean spring instanciation.</p>
  
  <p>We are using <strong>spring boot version 1.5.7.release</strong>.</p>
  
  <p><strong>First Infrastructure configuration</strong> </p>
  
  <pre><code>@Configuration
  @ComponentScan(basePackages = "com...jade")
  @EnableTransactionManagement
  @EnableJpaRepositories(entityManagerFactoryRef = "jadeEntityManager", transactionManagerRef = "jadeTransactionManager")
  @EntityScan(basePackages = { "com...jade", "org.springframework.data.jpa.convert.threeten" })
  @Profile({"ARA_JADE_CONF", "LOCAL_JADE_CONF"})
  public class InfrastructureConfig {
  
      private final static int JDBC_FETCH_SIZE = 1000;
  
      @Autowired
      private Environment environment;
  
      @Bean
      public LocalContainerEntityManagerFactoryBean jadeEntityManager() throws SQLException {
          LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
          em.setDataSource(dataSourceJade());
          em.setPackagesToScan(new String[] {"com...jade"});
          JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
          em.setJpaVendorAdapter(vendorAdapter);
          em.setJpaProperties(additionalProperties());
          return em;
      }
      @Bean
      @Primary
      public OracleDataSource dataSourceJade() throws SQLException {
          OracleDataSource dataSource = new OracleDataSource();
          dataSource.setUser(environment.getProperty("db.datasource.jade.username"));
          dataSource.setPassword(environment.getProperty("db.datasource.jade.password"));
          dataSource.setURL(environment.getProperty("db.datasource.jade.url"));
          dataSource.setImplicitCachingEnabled(true);
          dataSource.setFastConnectionFailoverEnabled(true);
          return dataSource;
      }
      @Bean(name="jdbcTemplateJade")
      public JdbcTemplate jdbcTemplateJade() throws SQLException {
          JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSourceJade());
          jdbcTemplate.setResultsMapCaseInsensitive(true);
          jdbcTemplate.setFetchSize(JDBC_FETCH_SIZE);
          return jdbcTemplate;
      }
      @Bean
      public PlatformTransactionManager transactionManager() throws SQLException{
          JpaTransactionManager transactionManager = new JpaTransactionManager();
          transactionManager.setEntityManagerFactory(jadeEntityManager().getObject());
  
          return transactionManager;
      }
      @Bean
      public PersistenceExceptionTranslationPostProcessor exceptionTranslation() {
          return new PersistenceExceptionTranslationPostProcessor();
      } ...
  </code></pre>
  
  <p><strong>Seconde Infrastructure configuration</strong></p>
  
  <pre><code>@Configuration
  @ComponentScan(basePackages =  "com.bnpparibas.sit.risk.art")
  @EnableTransactionManagement
  @EnableJpaRepositories(entityManagerFactoryRef = "artEntityManager", transactionManagerRef = "artTransactionManager")
  @EntityScan(basePackages = { "com...art", "org.springframework.data.jpa.convert.threeten" })
  @Profile({"LOCAL_ART_CONF,'ARA_ART_CONF"})
  public class ArtInfrastructureConfig {
  
      private final static int JDBC_FETCH_SIZE = 1000;
  
      @Autowired
      private Environment environment;
  
  
      @Bean
      @Primary
      public LocalContainerEntityManagerFactoryBean artEntityManager() throws SQLException {
          LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
          em.setDataSource(dataSourceArt());
          em.setPackagesToScan(new String[] {"com...art.infrastructure.persistence"});
          JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
          em.setJpaVendorAdapter(vendorAdapter);
          em.setJpaProperties(additionalProperties());
          return em;
      }
  
      @Bean
      @Primary
      public OracleDataSource dataSourceArt() throws SQLException {
          OracleDataSource dataSource = new OracleDataSource();
          dataSource.setUser(environment.getProperty("db.datasource.art.username"));
          dataSource.setPassword(environment.getProperty("db.datasource.art.password"));
          dataSource.setURL(environment.getProperty("db.datasource.art.url"));
          dataSource.setImplicitCachingEnabled(true);
          dataSource.setFastConnectionFailoverEnabled(true);
          return dataSource;
      }
  
      @Bean
      @Primary
      public PlatformTransactionManager artTransactionManager()throws SQLException{
          JpaTransactionManager transactionManager = new JpaTransactionManager();
          transactionManager.setEntityManagerFactory(artEntityManager().getObject());
  
          return transactionManager;
      }
  
      @Bean
      @Primary
      public PersistenceExceptionTranslationPostProcessor exceptionTranslation() {
          return new PersistenceExceptionTranslationPostProcessor();
      }...
  </code></pre>
  
  <p>Interface link to Entity.</p>
  
  <pre><code>@DDD.Repository
  @Repository
  public interface CollaborateurJpaRepository extends CrudRepository&lt;Collaborateur,String&gt;{
  
      @Query("FROM ART_PARAM.ART_USER u WHERE u.refogUID = :uid")
      Collaborateur findCollaborateurById(@Param("uid") String uid);
  }
  </code></pre>
  
  <p>Class that contain the autowired interface to retrieve some data of the second database.</p>
  
  <pre><code>@DDD.RepositoryImpl
  @Repository
  @Primary
  public class UserRepositoryImpl implements UserRepository {
  
      @Autowired
      private CollaborateurJpaRepository collaborateurJpaRepository;
  
      @Override
      //@Cacheable(cacheNames = CacheConfig.CACHE_JURIDICTION, key = CacheConfig.CACHE_KEY_UTILISATEUR_ID)
      @Transactional("entityManagerFactoryArt")
      public User retrieveUser(UserId userId) {
          if(userId.getValue() == null) {
              return null;
          } else {
              Collaborateur collaborateur = collaborateurJpaRepository.findOne(userId.getValue());
  
              return new User(collaborateur.getRefogUID(),collaborateur.getRefogFirstName(),collaborateur.getRefogLastName(),collaborateur.getProfile(),collaborateur.isActiveUser(),collaborateur.isBankingSecrecy());
          }
      }
  </code></pre>