I am using spring-test-dbunit and I get a warning in my Unit tests with this message:
Code:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
Just wanted to add the same solution as Java Config:
@Bean
public DataSource dataSource() {
DataSource dataSource = ...
return dataSource;
}
@Bean
public DatabaseConfigBean dbUnitDatabaseConfig() {
DatabaseConfigBean dbConfig = new com.github.springtestdbunit.bean.DatabaseConfigBean();
dbConfig.setDatatypeFactory(new org.dbunit.ext.h2.H2DataTypeFactory());
return dbConfig;
}
@Bean
public DatabaseDataSourceConnectionFactoryBean dbUnitDatabaseConnection() {
DatabaseDataSourceConnectionFactoryBean dbConnection = new com.github.springtestdbunit.bean.DatabaseDataSourceConnectionFactoryBean(dataSource());
dbConnection.setDatabaseConfig(dbUnitDatabaseConfig());
return dbConnection;
}