You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On afterPropertiesSet, LazyConnectionDataSourceProxy opens a connection to determine defaultAutoCommit and defaultTransactionIsolation. In case of exception, the latter is trapped, leading LazyConnectionDataSourceProxy to determine those properties when the connection is effectively requested by a consumer.
We use TestContainer to test our database interactions. The database startup takes a few seconds. To reduce test startup time, we start the database in a separate thread while the Spring context is initializing. LazyConnectionDataSourceProxy#checkDefaultConnectionProperties is the first consumer that makes the Spring Context initialization wait on the database startup thread.
It would be nice to have an option allowing to disable this eager check.
The text was updated successfully, but these errors were encountered:
jhoeller
changed the title
Add an option to disable LazyConnectionDataSourceProxy eager checkDefaultConnectionProperties call
Avoid eager checkDefaultConnectionProperties call in LazyConnectionDataSourceProxy
Dec 7, 2023
We are dropping the eager connection properties check completely, in favor of a late check on the first getConnection() call (but before exposing the Connection proxy, so still exposing consistent behavior for the consumer of the Connection proxy). As a consequence, there is no need for a configuration flag. If a startup-time check should be enforced (which we don't actually recommend these days), the new public checkDefaultConnectionProperties() method can be called. Even better would be to explicitly specify the defaultAutoCommit and defaultTransactionIsolation configuration settings.
Affects: 6.0.2
On
afterPropertiesSet
,LazyConnectionDataSourceProxy
opens a connection to determinedefaultAutoCommit
anddefaultTransactionIsolation
. In case of exception, the latter is trapped, leadingLazyConnectionDataSourceProxy
to determine those properties when the connection is effectively requested by a consumer.We use TestContainer to test our database interactions. The database startup takes a few seconds. To reduce test startup time, we start the database in a separate thread while the Spring context is initializing.
LazyConnectionDataSourceProxy#checkDefaultConnectionProperties
is the first consumer that makes the Spring Context initialization wait on the database startup thread.It would be nice to have an option allowing to disable this
eager check
.The text was updated successfully, but these errors were encountered: