Skip to content

R2DBC ConnectionFactory bean .close() method should be called/subscribed when available #26991

Closed
@elefeint

Description

@elefeint

When Spring Boot autoconfiguration instantiates io.r2dbc.spi.ConnectionFactory bean implementing io.r2dbc.spi.Closeable, the framework should have a custom destruction method invoke Closeable.close() and subscribe to the returned Publisher.

If a user application creates its own ConnectionFactory, it would be the user's responsibility to then close it. Although it might be nice to have a generic pre-destruction facility that looks for all R2DBC Closeable beans and closes them cleanly. The regular Spring bean destruction mechanism won't work here, since Spring Framework would call .close() but not subscribe to it, making it a no-op.

cc: @mp911de

Metadata

Metadata

Assignees

Labels

in: dataIssues in data modules (jdbc, orm, oxm, tx)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions