Skip to content

DataSource url property is ignored when there is no connection pool #19192

@filiphr

Description

@filiphr

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions