When there are multiple drivers on the classpath (e.g. h2 and postgres) and no connection pool is present. Then spring.datasource.url is not used, instead the embedded database is used.

I would expect that the datasource that is created is connected with the provided datasource URL.

I was debugging this a bit and from the DataSourceAutoConfiguration the PooledDataSourceConfiguration is not active since there is no connection pool. This means that EmbeddedDatabaseConfiguration would be active leading to EmbeddedDataSourceConfiguration to create the datasource and that one then creates EmbeddedDatabase.

This has clearly been an error on our side (forgetting to add the connection pool).

I'd suggest that the EmbeddedDataSourceConfiguration is actually renamed to NonPooledDataSourceConfiguration and then based on whether a datasource url is defined or not a SimpleDriverDataSource is used or the current behaviour is kept.

Comment From: wilkinsona

Closing in favour of #19576.

Comment From: filiphr

Thanks for fixing this @snicoll.