更新时间:2022-12-18 13:13:39
Spring 会在事务完成时调用 close()
,这可能来自提交或回滚.close()
是否真正关闭真正的 JDBC 连接取决于 DataSource
配置.如果它是一个普通的 JDBC 连接,那么它实际上会关闭.如果它是一个连接池,那么它可能会在关闭时返回到池中.
Spring calls close()
when the transaction finishes which could be from either a commit or rollback. Whether or not close()
actually closes a real JDBC connection depends on the DataSource
configuration. If it's a plain JDBC connection, then it will actually close. If it is a connection pool then it will probably just be returned to the pool on close.