@ -52,9 +52,9 @@ class MySqlDataSourceConfiguration extends DataSourceConfiguration {
if ( MYSQL_CONTAINER = = null ) {
if ( MYSQL_CONTAINER = = null ) {
MySQLContainer < ? > container = new MySQLContainer < > ( )
MySQLContainer < ? > container = new MySQLContainer < > ( "mysql:8.0.24" )
. withUsername ( "roo t" )
. withUsername ( "tes t" )
. withPassword ( "" )
. withPassword ( "test " )
. withConfigurationOverride ( "" ) ;
. withConfigurationOverride ( "" ) ;
container . start ( ) ;
container . start ( ) ;
@ -64,7 +64,7 @@ class MySqlDataSourceConfiguration extends DataSourceConfiguration {
MysqlDataSource dataSource = new MysqlDataSource ( ) ;
MysqlDataSource dataSource = new MysqlDataSource ( ) ;
dataSource . setUrl ( MYSQL_CONTAINER . getJdbcUrl ( ) ) ;
dataSource . setUrl ( MYSQL_CONTAINER . getJdbcUrl ( ) ) ;
dataSource . setUser ( MYSQL_CONTAINER . getUsername ( ) ) ;
dataSource . setUser ( "root" ) ;
dataSource . setPassword ( MYSQL_CONTAINER . getPassword ( ) ) ;
dataSource . setPassword ( MYSQL_CONTAINER . getPassword ( ) ) ;
dataSource . setDatabaseName ( MYSQL_CONTAINER . getDatabaseName ( ) ) ;
dataSource . setDatabaseName ( MYSQL_CONTAINER . getDatabaseName ( ) ) ;
@ -79,4 +79,15 @@ class MySqlDataSourceConfiguration extends DataSourceConfiguration {
new ByteArrayResource ( "DROP DATABASE test;CREATE DATABASE test;" . getBytes ( ) ) ) ;
new ByteArrayResource ( "DROP DATABASE test;CREATE DATABASE test;" . getBytes ( ) ) ) ;
}
}
}
}
private DataSource createRootDataSource ( ) {
MysqlDataSource dataSource = new MysqlDataSource ( ) ;
dataSource . setUrl ( MYSQL_CONTAINER . getJdbcUrl ( ) ) ;
dataSource . setUser ( "root" ) ;
dataSource . setPassword ( MYSQL_CONTAINER . getPassword ( ) ) ;
dataSource . setDatabaseName ( MYSQL_CONTAINER . getDatabaseName ( ) ) ;
return dataSource ;
}
}
}