title: Spring @Configuration is ignored
body: <p>I put the following dbunit configuration inside the parent class of all my test classes:</p>
  
  <pre><code>@Configuration
      public class MyDbUnitConfiguration {
  
          @Bean
          public DatabaseDataSourceConnectionFactoryBean dbUnitDatabaseConnection() {
              DatabaseConfigBean bean = new DatabaseConfigBean();
              bean.setDatatypeFactory(new MySqlDataTypeFactory());
              bean.setMetadataHandler(new MySqlMetadataHandler());
              bean.setSkipOracleRecyclebinTables(true);
              bean.setCaseSensitiveTableNames(false);
              bean.setAllowEmptyFields(true);
  
              String testDbName = getTestDbName();
              LOG.debug("Test database name: " + testDbName);
              DataSource dataSource = new DataSource();
              dataSource.setUsername(USERNAME);
              dataSource.setPassword(PASSWORD);
              dataSource.setDriverClassName(JDBC_DRIVER);
              String url = "jdbc:mysql://localhost:3306/" + testDbName;
              dataSource.setUrl(url);
  
              DatabaseDataSourceConnectionFactoryBean dbConnectionFactory = new DatabaseDataSourceConnectionFactoryBean(
                      dataSource);
              dbConnectionFactory.setDatabaseConfig(bean);
  
              return dbConnectionFactory;
          }
      }
  </code></pre>
  
  <p>However, this configuration gets ignored (no logs printed and properties actually not set) when I run any child test class.</p>
  
  <p><strong>The configuration is used when I put a @Component annotation on a child test class</strong>, but @Component can be used only once, elsewise an exception is printed:</p>
  
  <pre><code>org.springframework.beans.factory.NoUniqueBeanDefinitionException:
  No qualifying bean of type 'MyBaseTest' available: expected single matching bean but found 2: 
  FooTest,BarTest
  </code></pre>
  
  <p>Thus I cannot put a @Component annotation on every child test class.</p>
  
  <p>If the @Component annotation is put on parent test class, configuration is not loaded.</p>
  
  <p>Remark:
  every child test class uses a different database, whose name is retrieved using method <code>getTestDbName()</code>. I need this information to configure my database connection.</p>
  
  <p>What would be the right way to get the configuration loaded before every child test class is run? This is the configuration that dbunit will use to load the dataset of the tests.</p>