You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by as...@apache.org on 2026/06/24 10:21:24 UTC
(grails-website) branch asf-site-production updated: Deploying to documentation branch - 10:21:06
This is an automated email from the ASF dual-hosted git repository.
asf-ci-deploy pushed a commit to branch asf-site-production
in repository https://gitbox.apache.org/repos/asf/grails-website.git
The following commit(s) were added to refs/heads/asf-site-production by this push:
new 28beedbf8f8 Deploying to documentation branch - 10:21:06
28beedbf8f8 is described below
commit 28beedbf8f896b78fd6f7a8b8dbabb71e2e6397c
Author: codeconsole <co...@users.noreply.github.com>
AuthorDate: Wed Jun 24 10:21:09 2026 +0000
Deploying to documentation branch - 10:21:06
---
docs/snapshot/api/index-all.html | 14 ++++--
.../connections/DataSourceConnectionSource.html | 4 +-
.../MongoDbGormAutoConfiguration.html | 25 ++++++++--
.../core/connections/DefaultConnectionSource.html | 54 ++++++++++++++++++++--
.../datastore/mapping/mongo/MongoDatastore.html | 13 ++++--
.../connections/HibernateConnectionSource.html | 4 +-
docs/snapshot/grails-data/api/index-all.html | 8 +++-
.../connections/DataSourceConnectionSource.html | 4 +-
.../core/connections/DefaultConnectionSource.html | 54 ++++++++++++++++++++--
.../grails-data/hibernate5/api/index-all.html | 14 ++++--
.../connections/DataSourceConnectionSource.html | 4 +-
.../MongoDbGormAutoConfiguration.html | 25 ++++++++--
.../core/connections/DefaultConnectionSource.html | 54 ++++++++++++++++++++--
.../datastore/mapping/mongo/MongoDatastore.html | 13 ++++--
.../connections/HibernateConnectionSource.html | 4 +-
.../grails-data/hibernate7/api/index-all.html | 14 ++++--
.../connections/DataSourceConnectionSource.html | 4 +-
.../MongoDbGormAutoConfiguration.html | 25 ++++++++--
.../core/connections/DefaultConnectionSource.html | 54 ++++++++++++++++++++--
.../datastore/mapping/mongo/MongoDatastore.html | 13 ++++--
.../connections/HibernateConnectionSource.html | 4 +-
.../grails-data/mongodb/api/index-all.html | 6 ++-
.../MongoDbGormAutoConfiguration.html | 25 ++++++++--
.../datastore/mapping/mongo/MongoDatastore.html | 13 ++++--
.../connections/HibernateConnectionSource.html | 2 +-
.../manual/gettingStarted/outsideGrails.html | 23 +++++++++
.../snapshot/grails-data/mongodb/manual/index.html | 46 ++++++++++++++++++
.../mongodb/manual/introduction/upgradeNotes.html | 23 +++++++++
28 files changed, 467 insertions(+), 79 deletions(-)
diff --git a/docs/snapshot/api/index-all.html b/docs/snapshot/api/index-all.html
index 3adae7c6e94..1af11b276a5 100644
--- a/docs/snapshot/api/index-all.html
+++ b/docs/snapshot/api/index-all.html
@@ -5395,6 +5395,8 @@ if (location.href.indexOf('is-external=true') == -1) {
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/encoder/WriterEncodedAppender.html#close()" title="Method in WriterEncodedAppender">close()</a></span> - Method in <a href="org/grails/encoder/WriterEncodedAppender.html">WriterEncodedAppender</a>
</dt><dd> <div class="block"></div></dd>
+<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closeable" title="Field in DefaultConnectionSource">closeable</a></span> - Field in <a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html">DefaultConnectionSource</a>
+</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closed" title="Field in DefaultConnectionSource">closed</a></span> - Field in <a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html">DefaultConnectionSource</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/io/support/SpringIOUtils.html#closeQuietly(java.io.Closeable)" title="Method in SpringIOUtils">closeQuietly(java.io.Closeable)</a></span> - Method in <a href="org/grails/io/support/SpringIOUtils.html">SpringIOUtils</a>
@@ -8020,8 +8022,8 @@ if (location.href.indexOf('is-external=true') == -1) {
<dt><span class="strong"><a href="grails/gorm/annotation/CreatedDate.html" title="Annotation Type in grails.gorm.annotation">CreatedDate</a></span> - Annotation Type in <a href="./grails/gorm/annotation/package-summary.html">grails.gorm.annotation</a>
</dt><dd><div class="block">A property annotation used to apply auto-timestamping on a field
upon gorm insert events. </div></dd>
-<dt><span class="strong"><a href="org/grails/datastore/mapping/mongo/MongoDatastore.html#createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext)" title="Method in MongoDatastore">createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext)</a></span> - Method in [...]
-</dt><dd> <div class="block">Creates the connection sources for an existing MongoClient</div></dd>
+<dt><span class="strong"><a href="org/grails/datastore/mapping/mongo/MongoDatastore.html#createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext, boolean)" title="Method in MongoDatastore">createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext, boolean)</a></ [...]
+</dt><dd> <div class="block">Creates the connection sources for a MongoClient.</div></dd>
<dt><span class="strong"><a href="grails/events/bus/EventBusBuilder.html#createDefaultEventBus()" title="Method in EventBusBuilder">createDefaultEventBus()</a></span> - Method in <a href="grails/events/bus/EventBusBuilder.html">EventBusBuilder</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/events/bus/spring/EventBusFactoryBean.html#createDefaultEventBus()" title="Method in EventBusFactoryBean">createDefaultEventBus()</a></span> - Method in <a href="org/grails/events/bus/spring/EventBusFactoryBean.html">EventBusFactoryBean</a>
@@ -9921,8 +9923,8 @@ if (location.href.indexOf('is-external=true') == -1) {
</dt><dd><div class="block">Abstract implementation of the <a href='../../../../../../org/grails/datastore/mapping/core/connections/ConnectionSource.html' title='ConnectionSource'>ConnectionSource</a> interface</div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/AbstractConnectionSources.html#defaultConnectionSource" title="Field in AbstractConnectionSources">defaultConnectionSource</a></span> - Field in <a href="org/grails/datastore/mapping/core/connections/AbstractConnectionSources.html">AbstractConnectionSources</a>
</dt><dd> <div class="block"></div></dd>
-<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#DefaultConnectionSource(java.lang.String, T, S)" title="Constructor in DefaultConnectionSource">DefaultConnectionSource(java.lang.String, T, S)</a></span> - Constructor in <a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html">DefaultConnectionSource</a>
-</dt><dd> <div class="block"></div></dd>
+<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#DefaultConnectionSource(java.lang.String, T, S, boolean)" title="Constructor in DefaultConnectionSource">DefaultConnectionSource(java.lang.String, T, S, boolean)</a></span> - Constructor in <a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html">DefaultConnectionSource</a>
+</dt><dd> <div class="block">Creates a connection source, optionally taking ownership of the underlying source.</div></dd>
<dt><span class="strong"><a href="org/grails/web/plugins/support/DefaultConstrainedDiscovery.html" title="Class in org.grails.web.plugins.support">DefaultConstrainedDiscovery</a></span> - Class in <a href="./org/grails/web/plugins/support/package-summary.html">org.grails.web.plugins.support</a>
</dt><dd><div class="block">Discovers the default constrained properties for a domain class</div></dd>
<dt><span class="strong"><a href="org/grails/web/plugins/support/DefaultConstrainedDiscovery.html#DefaultConstrainedDiscovery()" title="Constructor in DefaultConstrainedDiscovery">DefaultConstrainedDiscovery()</a></span> - Constructor in <a href="org/grails/web/plugins/support/DefaultConstrainedDiscovery.html">DefaultConstrainedDiscovery</a>
@@ -10920,6 +10922,8 @@ if (location.href.indexOf('is-external=true') == -1) {
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/plugin/hibernate/support/HibernatePersistenceContextInterceptor.html#destroy()" title="Method in HibernatePersistenceContextInterceptor">destroy()</a></span> - Method in <a href="org/grails/plugin/hibernate/support/HibernatePersistenceContextInterceptor.html">HibernatePersistenceContextInterceptor</a>
</dt><dd> <div class="block"></div></dd>
+<dt><span class="strong"><a href="org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html#destroy()" title="Method in MongoDbGormAutoConfiguration">destroy()</a></span> - Method in <a href="org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html">MongoDbGormAutoConfiguration</a>
+</dt><dd> <div class="block">Closes the MongoClient only when it was created by this auto-configuration. </div></dd>
<dt><span class="strong"><a href="grails/persistence/support/NullPersistentContextInterceptor.html#destroy()" title="Method in NullPersistentContextInterceptor">destroy()</a></span> - Method in <a href="grails/persistence/support/NullPersistentContextInterceptor.html">NullPersistentContextInterceptor</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="grails/persistence/support/PersistenceContextInterceptor.html#destroy()" title="Method in PersistenceContextInterceptor">destroy()</a></span> - Method in <a href="grails/persistence/support/PersistenceContextInterceptor.html">PersistenceContextInterceptor</a>
@@ -28115,6 +28119,8 @@ if (location.href.indexOf('is-external=true') == -1) {
<dt><span class="strong"><a href="org/apache/grails/testing/cleanup/core/DatasourceCleanupMapping.html#isCleanAll()" title="Method in DatasourceCleanupMapping">isCleanAll()</a></span> - Method in <a href="org/apache/grails/testing/cleanup/core/DatasourceCleanupMapping.html">DatasourceCleanupMapping</a>
</dt><dd> <div class="block"> <DL><DT><B>Returns:</B></DT><DD><CODE>true</CODE> if no specific data sources were specified, meaning all
datas ources in the application context should be cleaned</DD></DL></div></dd>
+<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#isCloseable()" title="Method in DefaultConnectionSource">isCloseable()</a></span> - Method in <a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html">DefaultConnectionSource</a>
+</dt><dd> <div class="block"> <DL><DT><B>Returns:</B></DT><DD>whether <a href='#close()'>close()</a> will close the underlying <a href='#getSource()'>source</a>.</DD></DL></div></dd>
<dt><span class="strong"><a href="org/grails/buffer/StreamCharBuffer.StreamCharBufferWriter.html#isClosed()" title="Method in StreamCharBuffer.StreamCharBufferWriter">isClosed()</a></span> - Method in <a href="org/grails/buffer/StreamCharBuffer.StreamCharBufferWriter.html">StreamCharBuffer.StreamCharBufferWriter</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/model/config/GormMappingConfigurationStrategy.html#isCollectionType(java.lang.Class)" title="Method in GormMappingConfigurationStrategy">isCollectionType(java.lang.Class)</a></span> - Method in <a href="org/grails/datastore/mapping/model/config/GormMappingConfigurationStrategy.html">GormMappingConfigurationStrategy</a>
diff --git a/docs/snapshot/api/org/grails/datastore/gorm/jdbc/connections/DataSourceConnectionSource.html b/docs/snapshot/api/org/grails/datastore/gorm/jdbc/connections/DataSourceConnectionSource.html
index abfe8106dcf..553f512401d 100644
--- a/docs/snapshot/api/org/grails/datastore/gorm/jdbc/connections/DataSourceConnectionSource.html
+++ b/docs/snapshot/api/org/grails/datastore/gorm/jdbc/connections/DataSourceConnectionSource.html
@@ -132,7 +132,7 @@ extends <a href='../../../../../../org/grails/datastore/mapping/core/connections
</tr>
<tr class="altColor">
<td class="colFirst"><strong><code>class <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html'>DefaultConnectionSource</a></code></strong></td>
- <td class="colLast"><code><a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closed'>closed</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#name'>name</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#settings'>settings</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections [...]
+ <td class="colLast"><code><a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closeable'>closeable</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closed'>closed</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#name'>name</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connectio [...]
</tr>
</table>
@@ -208,7 +208,7 @@ extends <a href='../../../../../../org/grails/datastore/mapping/core/connections
<tr class="altColor">
<td class="colFirst"><code>class <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html'>DefaultConnectionSource</a></code></td>
- <td class="colLast"><code><a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#close()'>close</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getName()'>getName</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getSettings()'>getSettings</a>, <a href='../../../../../../org/grails/datastore/mapping/ [...]
+ <td class="colLast"><code><a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#close()'>close</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getName()'>getName</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getSettings()'>getSettings</a>, <a href='../../../../../../org/grails/datastore/mapping/ [...]
</tr>
</table>
</ul>
diff --git a/docs/snapshot/api/org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html b/docs/snapshot/api/org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html
index 03dbee8645a..15a88a1555e 100644
--- a/docs/snapshot/api/org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html
+++ b/docs/snapshot/api/org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html
@@ -99,7 +99,7 @@ if (location.href.indexOf('is-external=true') == -1) {
<dl>
<dt>All Implemented Interfaces and Traits:</dt>
- <dd><a href='../../../../../../../org.springframework.context.ApplicationContextAware.html'>ApplicationContextAware</a></dd>
+ <dd><a href='../../../../../../../org.springframework.context.ApplicationContextAware.html'>ApplicationContextAware</a>, <a href='../../../../../../../org.springframework.beans.factory.DisposableBean.html'>DisposableBean</a></dd>
</dl>
@@ -112,7 +112,7 @@ if (location.href.indexOf('is-external=true') == -1) {
@org.springframework.boot.autoconfigure.AutoConfigureAfter(value: MongoAutoConfiguration)
class MongoDbGormAutoConfiguration
extends java.lang.Object
-implements <a href='../../../../../../../org.springframework.context.ApplicationContextAware.html'>ApplicationContextAware</a></pre>
+implements <a href='../../../../../../../org.springframework.context.ApplicationContextAware.html'>ApplicationContextAware</a>, <a href='../../../../../../../org.springframework.beans.factory.DisposableBean.html'>DisposableBean</a></pre>
<p>
Auto configurer that configures GORM for MongoDB for use in Spring Boot <DL><DT><B>Authors:</B></DT><DD>Graeme Rocher</DD></DL><DL><DT><B>Since:</B></DT><DD>1.0</DD></DL></p>
@@ -209,18 +209,24 @@ implements <a href='../../../../../../../org.springframework.context.Application
</tr>
<tr class="altColor">
+ <td class="colFirst"><code></code></td>
+ <td class="colLast"><code>void</code></td>
+ <td class="colLast"><code><strong><a href="#destroy()">destroy</a></strong>()</code><br>Closes the MongoClient only when it was created by this auto-configuration. </td>
+ </tr>
+
+ <tr class="rowColor">
<td class="colFirst"><code></code></td>
<td class="colLast"><code><a href='../../../../../../../org/grails/datastore/mapping/mongo/MongoDatastore.html'>MongoDatastore</a></code></td>
<td class="colLast"><code><strong><a href="#mongoDatastore()">mongoDatastore</a></strong>()</code><br></td>
</tr>
- <tr class="rowColor">
+ <tr class="altColor">
<td class="colFirst"><code></code></td>
<td class="colLast"><code><a href='../../../../../../../org.springframework.transaction.PlatformTransactionManager.html'>PlatformTransactionManager</a></code></td>
<td class="colLast"><code><strong><a href="#mongoTransactionManager()">mongoTransactionManager</a></strong>()</code><br></td>
</tr>
- <tr class="altColor">
+ <tr class="rowColor">
<td class="colFirst"><code></code></td>
<td class="colLast"><code>void</code></td>
<td class="colLast"><code><strong><a href="#setApplicationContext(org.springframework.context.ApplicationContext)">setApplicationContext</a></strong>(<a href='../../../../../../../org.springframework.context.ApplicationContext.html'>ApplicationContext</a> applicationContext)</code><br></td>
@@ -328,6 +334,17 @@ implements <a href='../../../../../../../org.springframework.context.Application
</a>
<h3>Method Detail</h3>
+ <a name="destroy()"><!-- --></a>
+ <ul class="blockListLast">
+ <li class="blockList">
+ <h4>@java.lang.Override<br>void <strong>destroy</strong>()</h4>
+ <p> Closes the MongoClient only when it was created by this auto-configuration. A client
+ supplied as an existing bean is owned by the application context (or the user) and must not be
+ closed here. The <CODE>mongoDatastore</CODE> bean is created after this configuration, so it is
+ destroyed first, leaving its sessions closed before the client itself is closed.</p>
+ </li>
+ </ul>
+
<a name="mongoDatastore()"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
diff --git a/docs/snapshot/api/org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html b/docs/snapshot/api/org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html
index 75481f76da7..702913ca499 100644
--- a/docs/snapshot/api/org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html
+++ b/docs/snapshot/api/org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html
@@ -141,23 +141,29 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
<tr class="altColor">
<td class="colFirst"><code><strong>protected boolean</strong></code> </td>
- <td class="colLast"><code><a href="#closed">closed</a></code></td>
+ <td class="colLast"><code><a href="#closeable">closeable</a></code></td>
<td class="colLast"></td>
</tr>
<tr class="rowColor">
+ <td class="colFirst"><code><strong>protected boolean</strong></code> </td>
+ <td class="colLast"><code><a href="#closed">closed</a></code></td>
+ <td class="colLast"></td>
+ </tr>
+
+ <tr class="altColor">
<td class="colFirst"><code><strong>protected java.lang.String</strong></code> </td>
<td class="colLast"><code><a href="#name">name</a></code></td>
<td class="colLast"></td>
</tr>
- <tr class="altColor">
+ <tr class="rowColor">
<td class="colFirst"><code><strong>protected S</strong></code> </td>
<td class="colLast"><code><a href="#settings">settings</a></code></td>
<td class="colLast"></td>
</tr>
- <tr class="rowColor">
+ <tr class="altColor">
<td class="colFirst"><code><strong>protected T</strong></code> </td>
<td class="colLast"><code><a href="#source">source</a></code></td>
<td class="colLast"></td>
@@ -193,6 +199,11 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
<code><strong><a href="#DefaultConnectionSource(java.lang.String, T, S)">DefaultConnectionSource</a></strong>(java.lang.String name, T source, S settings)</code><br></td>
</tr>
+ <tr class="rowColor">
+ <td class="colFirst">
+ <code><strong><a href="#DefaultConnectionSource(java.lang.String, T, S, boolean)">DefaultConnectionSource</a></strong>(java.lang.String name, T source, S settings, boolean closeable)</code><br>Creates a connection source, optionally taking ownership of the underlying source.</td>
+ </tr>
+
</table>
</ul>
</li>
@@ -238,6 +249,12 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
<td class="colLast"><code><strong><a href="#getSource()">getSource</a></strong>()</code><br></td>
</tr>
+ <tr class="altColor">
+ <td class="colFirst"><code></code></td>
+ <td class="colLast"><code>public boolean</code></td>
+ <td class="colLast"><code><strong><a href="#isCloseable()">isCloseable</a></strong>()</code><br> <DL><DT><B>Returns:</B></DT><DD>whether <a href='#close()'>close()</a> will close the underlying <a href='#getSource()'>source</a>.</DD></DL></td>
+ </tr>
+
</table>
</ul>
</li>
@@ -279,6 +296,14 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
</a>
<h3>Field Detail</h3>
+ <a name="closeable"><!-- --></a>
+ <ul class="blockListLast">
+ <li class="blockList">
+ <h4>protected final boolean <strong>closeable</strong></h4>
+ <p></p>
+ </li>
+ </ul>
+
<a name="closed"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
@@ -335,6 +360,18 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
</li>
</ul>
+ <a name="DefaultConnectionSource(java.lang.String, T, S, boolean)"><!-- --></a>
+ <ul class="blockListLast">
+ <li class="blockList">
+ <h4>public <strong>DefaultConnectionSource</strong>(java.lang.String name, T source, S settings, boolean closeable)</h4>
+ <p> Creates a connection source, optionally taking ownership of the underlying source.
+ <DL><DT><B>Parameters:</B></DT><DD><code>name</code> - the name of the connection source</DD><DD><code>source</code> - the underlying native source (for example a <CODE>MongoClient</CODE> or <CODE>DataSource</CODE>)</DD><DD><code>settings</code> - the settings</DD><DD><code>closeable</code> - whether <a href='#close()'>close()</a> should close the underlying <CODE>source</CODE>. Pass
+ <CODE>false</CODE> when the source is externally managed and its lifecycle is owned
+ by the provider (for example a Spring-managed <CODE>MongoClient</CODE> bean), so that
+ GORM does not close a source it did not create.</DD></DL><DL><DT><B>Since:</B></DT><DD>8.0</DD></DL></p>
+ </li>
+ </ul>
+
</li>
</ul>
@@ -380,6 +417,17 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
</li>
</ul>
+ <a name="isCloseable()"><!-- --></a>
+ <ul class="blockListLast">
+ <li class="blockList">
+ <h4>public boolean <strong>isCloseable</strong>()</h4>
+ <p>
+ <DL><DT><B>Returns:</B></DT><DD>whether <a href='#close()'>close()</a> will close the underlying <a href='#getSource()'>source</a>. When
+ <CODE>false</CODE> the source is externally managed and its lifecycle is owned by the provider, so
+ GORM will not close it.</DD></DL><DL><DT><B>Since:</B></DT><DD>8.0</DD></DL></p>
+ </li>
+ </ul>
+
</li>
</ul>
diff --git a/docs/snapshot/api/org/grails/datastore/mapping/mongo/MongoDatastore.html b/docs/snapshot/api/org/grails/datastore/mapping/mongo/MongoDatastore.html
index ed3b7fcfe10..c856acde6e1 100644
--- a/docs/snapshot/api/org/grails/datastore/mapping/mongo/MongoDatastore.html
+++ b/docs/snapshot/api/org/grails/datastore/mapping/mongo/MongoDatastore.html
@@ -521,7 +521,7 @@ implements <a href='../../../../../MappingContextListener.html'>MappingContextLi
<tr class="altColor">
<td class="colFirst"><code></code></td>
<td class="colLast"><code>protected static ConnectionSources<MongoClient, <a href='../../../../../org/grails/datastore/mapping/mongo/connections/MongoConnectionSourceSettings.html' title='MongoConnectionSourceSettings'>MongoConnectionSourceSettings</a>></code></td>
- <td class="colLast"><code><strong><a href="#createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext)">createDefaultConnectionSources</a></strong>(<a href='../../../../../com.mongodb.client.MongoClient.html'>MongoClient</a> mongoClient, <a href='../../../../../org.springframework.core.env.PropertyResolver.html'>PropertyResolver</a> configuration, [...]
+ <td class="colLast"><code><strong><a href="#createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext, boolean)">createDefaultConnectionSources</a></strong>(<a href='../../../../../com.mongodb.client.MongoClient.html'>MongoClient</a> mongoClient, <a href='../../../../../org.springframework.core.env.PropertyResolver.html'>PropertyResolver</a> config [...]
</tr>
<tr class="rowColor">
@@ -1346,12 +1346,15 @@ implements <a href='../../../../../MappingContextListener.html'>MappingContextLi
</li>
</ul>
- <a name="createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext)"><!-- --></a>
+ <a name="createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext, boolean)"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
- <h4>protected static ConnectionSources<MongoClient, <a href='../../../../../org/grails/datastore/mapping/mongo/connections/MongoConnectionSourceSettings.html' title='MongoConnectionSourceSettings'>MongoConnectionSourceSettings</a>> <strong>createDefaultConnectionSources</strong>(<a href='../../../../../com.mongodb.client.MongoClient.html'>MongoClient</a> mongoClient, <a href='../../../../../org.springframework.core.env.PropertyResolver.html [...]
- <p> Creates the connection sources for an existing MongoClient
- <DL><DT><B>Parameters:</B></DT><DD><code>mongoClient</code> - The MongoClient</DD><DD><code>configuration</code> - The configuration</DD><DD><code>mappingContext</code> - The <a href='../../../../../org/grails/datastore/mapping/mongo/config/MongoMappingContext.html' title='MongoMappingContext'>MongoMappingContext</a></DD></DL><DL><DT><B>Returns:</B></DT><DD>The ConnectionSources</DD></DL></p>
+ <h4>protected static ConnectionSources<MongoClient, <a href='../../../../../org/grails/datastore/mapping/mongo/connections/MongoConnectionSourceSettings.html' title='MongoConnectionSourceSettings'>MongoConnectionSourceSettings</a>> <strong>createDefaultConnectionSources</strong>(<a href='../../../../../com.mongodb.client.MongoClient.html'>MongoClient</a> mongoClient, <a href='../../../../../org.springframework.core.env.PropertyResolver.html [...]
+ <p> Creates the connection sources for a MongoClient.
+ <DL><DT><B>Parameters:</B></DT><DD><code>mongoClient</code> - The MongoClient</DD><DD><code>configuration</code> - The configuration</DD><DD><code>mappingContext</code> - The <a href='../../../../../org/grails/datastore/mapping/mongo/config/MongoMappingContext.html' title='MongoMappingContext'>MongoMappingContext</a></DD><DD><code>closeable</code> - whether GORM owns the client and should close it on shutdown. Pass
+ <CODE>false</CODE> for an externally-supplied client (its lifecycle is owned by the
+ caller, e.g. a Spring-managed bean) and <CODE>true</CODE> for a client GORM created
+ itself, so it is not leaked.</DD></DL><DL><DT><B>Returns:</B></DT><DD>The ConnectionSources</DD></DL></p>
</li>
</ul>
diff --git a/docs/snapshot/api/org/grails/orm/hibernate/connections/HibernateConnectionSource.html b/docs/snapshot/api/org/grails/orm/hibernate/connections/HibernateConnectionSource.html
index b4590987f63..673ff138ab4 100644
--- a/docs/snapshot/api/org/grails/orm/hibernate/connections/HibernateConnectionSource.html
+++ b/docs/snapshot/api/org/grails/orm/hibernate/connections/HibernateConnectionSource.html
@@ -154,7 +154,7 @@ extends <a href='../../../../../org/grails/datastore/mapping/core/connections/De
</tr>
<tr class="altColor">
<td class="colFirst"><strong><code>class <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html'>DefaultConnectionSource</a></code></strong></td>
- <td class="colLast"><code><a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closed'>closed</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#name'>name</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#settings'>settings</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConn [...]
+ <td class="colLast"><code><a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closeable'>closeable</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closed'>closed</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#name'>name</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultCo [...]
</tr>
</table>
@@ -236,7 +236,7 @@ extends <a href='../../../../../org/grails/datastore/mapping/core/connections/De
<tr class="altColor">
<td class="colFirst"><code>class <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html'>DefaultConnectionSource</a></code></td>
- <td class="colLast"><code><a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#close()'>close</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getName()'>getName</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getSettings()'>getSettings</a>, <a href='../../../../../org/grails/datastore/mapping/core/connect [...]
+ <td class="colLast"><code><a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#close()'>close</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getName()'>getName</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getSettings()'>getSettings</a>, <a href='../../../../../org/grails/datastore/mapping/core/connect [...]
</tr>
</table>
</ul>
diff --git a/docs/snapshot/grails-data/api/index-all.html b/docs/snapshot/grails-data/api/index-all.html
index 1e37c917a92..67086cb6b75 100644
--- a/docs/snapshot/grails-data/api/index-all.html
+++ b/docs/snapshot/grails-data/api/index-all.html
@@ -1208,6 +1208,8 @@ if (location.href.indexOf('is-external=true') == -1) {
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/gorm/jdbc/MultiTenantConnection.html#close()" title="Method in MultiTenantConnection">close()</a></span> - Method in <a href="org/grails/datastore/gorm/jdbc/MultiTenantConnection.html">MultiTenantConnection</a>
</dt><dd> <div class="block"></div></dd>
+<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closeable" title="Field in DefaultConnectionSource">closeable</a></span> - Field in <a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html">DefaultConnectionSource</a>
+</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closed" title="Field in DefaultConnectionSource">closed</a></span> - Field in <a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html">DefaultConnectionSource</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/core/DatastoreUtils.html#closeSession(org.grails.datastore.mapping.core.Session)" title="Method in DatastoreUtils">closeSession(org.grails.datastore.mapping.core.Session)</a></span> - Method in <a href="org/grails/datastore/mapping/core/DatastoreUtils.html">DatastoreUtils</a>
@@ -2145,8 +2147,8 @@ if (location.href.indexOf('is-external=true') == -1) {
</dt><dd><div class="block">Abstract implementation of the <a href='../../../../../../org/grails/datastore/mapping/core/connections/ConnectionSource.html' title='ConnectionSource'>ConnectionSource</a> interface</div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/AbstractConnectionSources.html#defaultConnectionSource" title="Field in AbstractConnectionSources">defaultConnectionSource</a></span> - Field in <a href="org/grails/datastore/mapping/core/connections/AbstractConnectionSources.html">AbstractConnectionSources</a>
</dt><dd> <div class="block"></div></dd>
-<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#DefaultConnectionSource(java.lang.String, T, S)" title="Constructor in DefaultConnectionSource">DefaultConnectionSource(java.lang.String, T, S)</a></span> - Constructor in <a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html">DefaultConnectionSource</a>
-</dt><dd> <div class="block"></div></dd>
+<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#DefaultConnectionSource(java.lang.String, T, S, boolean)" title="Constructor in DefaultConnectionSource">DefaultConnectionSource(java.lang.String, T, S, boolean)</a></span> - Constructor in <a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html">DefaultConnectionSource</a>
+</dt><dd> <div class="block">Creates a connection source, optionally taking ownership of the underlying source.</div></dd>
<dt><span class="strong"><a href="grails/gorm/validation/DefaultConstrainedProperty.html" title="Class in grails.gorm.validation">DefaultConstrainedProperty</a></span> - Class in <a href="./grails/gorm/validation/package-summary.html">grails.gorm.validation</a>
</dt><dd><div class="block">Default implementation of the <a href='../../../grails/gorm/validation/ConstrainedProperty.html' title='ConstrainedProperty'>ConstrainedProperty</a> interface</div></dd>
<dt><span class="strong"><a href="grails/gorm/validation/DefaultConstrainedProperty.html#DefaultConstrainedProperty(Class<?>, java.lang.String, Class<?>, org.grails.datastore.gorm.validation.constraints.registry.ConstraintRegistry)" title="Constructor in DefaultConstrainedProperty">DefaultConstrainedProperty(Class<?>, java.lang.String, Class<?>, org.grails.datastore.gorm.validation.constraints.registry.ConstraintRegistry)</a></span> - Constructor in <a href="grails/gorm/valid [...]
@@ -5796,6 +5798,8 @@ if (location.href.indexOf('is-external=true') == -1) {
</dt><dd> <div class="block"> <DL><DT><B>Returns:</B></DT><DD>Whether the association is circular</DD></DL></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/reflect/ClassUtils.html#isClassBelowPackage(Class<?>, java.util.List)" title="Method in ClassUtils">isClassBelowPackage(Class<?>, java.util.List)</a></span> - Method in <a href="org/grails/datastore/mapping/reflect/ClassUtils.html">ClassUtils</a>
</dt><dd> <div class="block"></div></dd>
+<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#isCloseable()" title="Method in DefaultConnectionSource">isCloseable()</a></span> - Method in <a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html">DefaultConnectionSource</a>
+</dt><dd> <div class="block"> <DL><DT><B>Returns:</B></DT><DD>whether <a href='#close()'>close()</a> will close the underlying <a href='#getSource()'>source</a>.</DD></DL></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/model/config/GormMappingConfigurationStrategy.html#isCollectionType(java.lang.Class)" title="Method in GormMappingConfigurationStrategy">isCollectionType(java.lang.Class)</a></span> - Method in <a href="org/grails/datastore/mapping/model/config/GormMappingConfigurationStrategy.html">GormMappingConfigurationStrategy</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/gorm/services/implementers/AbstractArrayOrIterableResultImplementer.html#isCompatibleReturnType(org.codehaus.groovy.ast.ClassNode, org.codehaus.groovy.ast.MethodNode, org.codehaus.groovy.ast.ClassNode, java.lang.String)" title="Method in AbstractArrayOrIterableResultImplementer">isCompatibleReturnType(org.codehaus.groovy.ast.ClassNode, org.codehaus.groovy.ast.MethodNode, org.codehaus.groovy.ast.ClassNode, java.lang.String)</a></span> [...]
diff --git a/docs/snapshot/grails-data/api/org/grails/datastore/gorm/jdbc/connections/DataSourceConnectionSource.html b/docs/snapshot/grails-data/api/org/grails/datastore/gorm/jdbc/connections/DataSourceConnectionSource.html
index 5d1a045d818..a125ab44e44 100644
--- a/docs/snapshot/grails-data/api/org/grails/datastore/gorm/jdbc/connections/DataSourceConnectionSource.html
+++ b/docs/snapshot/grails-data/api/org/grails/datastore/gorm/jdbc/connections/DataSourceConnectionSource.html
@@ -132,7 +132,7 @@ extends <a href='../../../../../../org/grails/datastore/mapping/core/connections
</tr>
<tr class="altColor">
<td class="colFirst"><strong><code>class <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html'>DefaultConnectionSource</a></code></strong></td>
- <td class="colLast"><code><a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closed'>closed</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#name'>name</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#settings'>settings</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections [...]
+ <td class="colLast"><code><a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closeable'>closeable</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closed'>closed</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#name'>name</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connectio [...]
</tr>
</table>
@@ -208,7 +208,7 @@ extends <a href='../../../../../../org/grails/datastore/mapping/core/connections
<tr class="altColor">
<td class="colFirst"><code>class <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html'>DefaultConnectionSource</a></code></td>
- <td class="colLast"><code><a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#close()'>close</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getName()'>getName</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getSettings()'>getSettings</a>, <a href='../../../../../../org/grails/datastore/mapping/ [...]
+ <td class="colLast"><code><a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#close()'>close</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getName()'>getName</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getSettings()'>getSettings</a>, <a href='../../../../../../org/grails/datastore/mapping/ [...]
</tr>
</table>
</ul>
diff --git a/docs/snapshot/grails-data/api/org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html b/docs/snapshot/grails-data/api/org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html
index 3bbd083f31f..52687d0353a 100644
--- a/docs/snapshot/grails-data/api/org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html
+++ b/docs/snapshot/grails-data/api/org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html
@@ -141,23 +141,29 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
<tr class="altColor">
<td class="colFirst"><code><strong>protected boolean</strong></code> </td>
- <td class="colLast"><code><a href="#closed">closed</a></code></td>
+ <td class="colLast"><code><a href="#closeable">closeable</a></code></td>
<td class="colLast"></td>
</tr>
<tr class="rowColor">
+ <td class="colFirst"><code><strong>protected boolean</strong></code> </td>
+ <td class="colLast"><code><a href="#closed">closed</a></code></td>
+ <td class="colLast"></td>
+ </tr>
+
+ <tr class="altColor">
<td class="colFirst"><code><strong>protected java.lang.String</strong></code> </td>
<td class="colLast"><code><a href="#name">name</a></code></td>
<td class="colLast"></td>
</tr>
- <tr class="altColor">
+ <tr class="rowColor">
<td class="colFirst"><code><strong>protected S</strong></code> </td>
<td class="colLast"><code><a href="#settings">settings</a></code></td>
<td class="colLast"></td>
</tr>
- <tr class="rowColor">
+ <tr class="altColor">
<td class="colFirst"><code><strong>protected T</strong></code> </td>
<td class="colLast"><code><a href="#source">source</a></code></td>
<td class="colLast"></td>
@@ -193,6 +199,11 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
<code><strong><a href="#DefaultConnectionSource(java.lang.String, T, S)">DefaultConnectionSource</a></strong>(java.lang.String name, T source, S settings)</code><br></td>
</tr>
+ <tr class="rowColor">
+ <td class="colFirst">
+ <code><strong><a href="#DefaultConnectionSource(java.lang.String, T, S, boolean)">DefaultConnectionSource</a></strong>(java.lang.String name, T source, S settings, boolean closeable)</code><br>Creates a connection source, optionally taking ownership of the underlying source.</td>
+ </tr>
+
</table>
</ul>
</li>
@@ -238,6 +249,12 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
<td class="colLast"><code><strong><a href="#getSource()">getSource</a></strong>()</code><br></td>
</tr>
+ <tr class="altColor">
+ <td class="colFirst"><code></code></td>
+ <td class="colLast"><code>public boolean</code></td>
+ <td class="colLast"><code><strong><a href="#isCloseable()">isCloseable</a></strong>()</code><br> <DL><DT><B>Returns:</B></DT><DD>whether <a href='#close()'>close()</a> will close the underlying <a href='#getSource()'>source</a>.</DD></DL></td>
+ </tr>
+
</table>
</ul>
</li>
@@ -279,6 +296,14 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
</a>
<h3>Field Detail</h3>
+ <a name="closeable"><!-- --></a>
+ <ul class="blockListLast">
+ <li class="blockList">
+ <h4>protected final boolean <strong>closeable</strong></h4>
+ <p></p>
+ </li>
+ </ul>
+
<a name="closed"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
@@ -335,6 +360,18 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
</li>
</ul>
+ <a name="DefaultConnectionSource(java.lang.String, T, S, boolean)"><!-- --></a>
+ <ul class="blockListLast">
+ <li class="blockList">
+ <h4>public <strong>DefaultConnectionSource</strong>(java.lang.String name, T source, S settings, boolean closeable)</h4>
+ <p> Creates a connection source, optionally taking ownership of the underlying source.
+ <DL><DT><B>Parameters:</B></DT><DD><code>name</code> - the name of the connection source</DD><DD><code>source</code> - the underlying native source (for example a <CODE>MongoClient</CODE> or <CODE>DataSource</CODE>)</DD><DD><code>settings</code> - the settings</DD><DD><code>closeable</code> - whether <a href='#close()'>close()</a> should close the underlying <CODE>source</CODE>. Pass
+ <CODE>false</CODE> when the source is externally managed and its lifecycle is owned
+ by the provider (for example a Spring-managed <CODE>MongoClient</CODE> bean), so that
+ GORM does not close a source it did not create.</DD></DL><DL><DT><B>Since:</B></DT><DD>8.0</DD></DL></p>
+ </li>
+ </ul>
+
</li>
</ul>
@@ -380,6 +417,17 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
</li>
</ul>
+ <a name="isCloseable()"><!-- --></a>
+ <ul class="blockListLast">
+ <li class="blockList">
+ <h4>public boolean <strong>isCloseable</strong>()</h4>
+ <p>
+ <DL><DT><B>Returns:</B></DT><DD>whether <a href='#close()'>close()</a> will close the underlying <a href='#getSource()'>source</a>. When
+ <CODE>false</CODE> the source is externally managed and its lifecycle is owned by the provider, so
+ GORM will not close it.</DD></DL><DL><DT><B>Since:</B></DT><DD>8.0</DD></DL></p>
+ </li>
+ </ul>
+
</li>
</ul>
diff --git a/docs/snapshot/grails-data/hibernate5/api/index-all.html b/docs/snapshot/grails-data/hibernate5/api/index-all.html
index 765bb20eda3..d4b522e893d 100644
--- a/docs/snapshot/grails-data/hibernate5/api/index-all.html
+++ b/docs/snapshot/grails-data/hibernate5/api/index-all.html
@@ -2059,6 +2059,8 @@ if (location.href.indexOf('is-external=true') == -1) {
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/gorm/jdbc/MultiTenantConnection.html#close()" title="Method in MultiTenantConnection">close()</a></span> - Method in <a href="org/grails/datastore/gorm/jdbc/MultiTenantConnection.html">MultiTenantConnection</a>
</dt><dd> <div class="block"></div></dd>
+<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closeable" title="Field in DefaultConnectionSource">closeable</a></span> - Field in <a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html">DefaultConnectionSource</a>
+</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closed" title="Field in DefaultConnectionSource">closed</a></span> - Field in <a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html">DefaultConnectionSource</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/plugins/databasemigration/liquibase/GroovyChange.1.html#closeResources(java.sql.Connection)" title="Method in GroovyChange.1">closeResources(java.sql.Connection)</a></span> - Method in <a href="org/grails/plugins/databasemigration/liquibase/GroovyChange.1.html">GroovyChange.1</a>
@@ -3117,8 +3119,8 @@ if (location.href.indexOf('is-external=true') == -1) {
<dt><span class="strong"><a href="grails/gorm/annotation/CreatedDate.html" title="Annotation Type in grails.gorm.annotation">CreatedDate</a></span> - Annotation Type in <a href="./grails/gorm/annotation/package-summary.html">grails.gorm.annotation</a>
</dt><dd><div class="block">A property annotation used to apply auto-timestamping on a field
upon gorm insert events. </div></dd>
-<dt><span class="strong"><a href="org/grails/datastore/mapping/mongo/MongoDatastore.html#createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext)" title="Method in MongoDatastore">createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext)</a></span> - Method in [...]
-</dt><dd> <div class="block">Creates the connection sources for an existing MongoClient</div></dd>
+<dt><span class="strong"><a href="org/grails/datastore/mapping/mongo/MongoDatastore.html#createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext, boolean)" title="Method in MongoDatastore">createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext, boolean)</a></ [...]
+</dt><dd> <div class="block">Creates the connection sources for a MongoClient.</div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/model/MappingFactory.html#createDefaultIdentityMapping(org.grails.datastore.mapping.model.ClassMapping, T)" title="Method in MappingFactory">createDefaultIdentityMapping(org.grails.datastore.mapping.model.ClassMapping, T)</a></span> - Method in <a href="org/grails/datastore/mapping/model/MappingFactory.html">MappingFactory</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/gorm/transform/AbstractMethodDecoratingTransformation.html#createDelegingMethodBody(org.codehaus.groovy.ast.Parameter, org.codehaus.groovy.ast.expr.MethodCallExpression)" title="Method in AbstractMethodDecoratingTransformation">createDelegingMethodBody(org.codehaus.groovy.ast.Parameter, org.codehaus.groovy.ast.expr.MethodCallExpression)</a></span> - Method in <a href="org/grails/datastore/gorm/transform/AbstractMethodDecoratingTransf [...]
@@ -3983,8 +3985,8 @@ if (location.href.indexOf('is-external=true') == -1) {
</dt><dd><div class="block">Abstract implementation of the <a href='../../../../../../org/grails/datastore/mapping/core/connections/ConnectionSource.html' title='ConnectionSource'>ConnectionSource</a> interface</div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/AbstractConnectionSources.html#defaultConnectionSource" title="Field in AbstractConnectionSources">defaultConnectionSource</a></span> - Field in <a href="org/grails/datastore/mapping/core/connections/AbstractConnectionSources.html">AbstractConnectionSources</a>
</dt><dd> <div class="block"></div></dd>
-<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#DefaultConnectionSource(java.lang.String, T, S)" title="Constructor in DefaultConnectionSource">DefaultConnectionSource(java.lang.String, T, S)</a></span> - Constructor in <a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html">DefaultConnectionSource</a>
-</dt><dd> <div class="block"></div></dd>
+<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#DefaultConnectionSource(java.lang.String, T, S, boolean)" title="Constructor in DefaultConnectionSource">DefaultConnectionSource(java.lang.String, T, S, boolean)</a></span> - Constructor in <a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html">DefaultConnectionSource</a>
+</dt><dd> <div class="block">Creates a connection source, optionally taking ownership of the underlying source.</div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/config/AbstractGormMappingFactory.html#defaultConstraints" title="Field in AbstractGormMappingFactory">defaultConstraints</a></span> - Field in <a href="org/grails/datastore/mapping/config/AbstractGormMappingFactory.html">AbstractGormMappingFactory</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/orm/hibernate/cfg/HibernateMappingBuilder.html#defaultConstraints" title="Property in HibernateMappingBuilder">defaultConstraints</a></span> - Property in <a href="org/grails/orm/hibernate/cfg/HibernateMappingBuilder.html">HibernateMappingBuilder</a>
@@ -4322,6 +4324,8 @@ if (location.href.indexOf('is-external=true') == -1) {
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/plugin/hibernate/support/HibernatePersistenceContextInterceptor.html#destroy()" title="Method in HibernatePersistenceContextInterceptor">destroy()</a></span> - Method in <a href="org/grails/plugin/hibernate/support/HibernatePersistenceContextInterceptor.html">HibernatePersistenceContextInterceptor</a>
</dt><dd> <div class="block"></div></dd>
+<dt><span class="strong"><a href="org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html#destroy()" title="Method in MongoDbGormAutoConfiguration">destroy()</a></span> - Method in <a href="org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html">MongoDbGormAutoConfiguration</a>
+</dt><dd> <div class="block">Closes the MongoClient only when it was created by this auto-configuration. </div></dd>
<dt><span class="strong"><a href="org/grails/datastore/gorm/services/implementers/AbstractDetachedCriteriaServiceImplementor.html#DETACHED_CRITERIA" title="Field in AbstractDetachedCriteriaServiceImplementor">DETACHED_CRITERIA</a></span> - Field in <a href="org/grails/datastore/gorm/services/implementers/AbstractDetachedCriteriaServiceImplementor.html">AbstractDetachedCriteriaServiceImplementor</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/gorm/query/transform/DetachedCriteriaTransformer.html#DETACHED_CRITERIA_CLASS_NODE" title="Field in DetachedCriteriaTransformer">DETACHED_CRITERIA_CLASS_NODE</a></span> - Field in <a href="org/grails/datastore/gorm/query/transform/DetachedCriteriaTransformer.html">DetachedCriteriaTransformer</a>
@@ -10279,6 +10283,8 @@ if (location.href.indexOf('is-external=true') == -1) {
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/reflect/ClassUtils.html#isClassBelowPackage(Class<?>, java.util.List)" title="Method in ClassUtils">isClassBelowPackage(Class<?>, java.util.List)</a></span> - Method in <a href="org/grails/datastore/mapping/reflect/ClassUtils.html">ClassUtils</a>
</dt><dd> <div class="block"></div></dd>
+<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#isCloseable()" title="Method in DefaultConnectionSource">isCloseable()</a></span> - Method in <a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html">DefaultConnectionSource</a>
+</dt><dd> <div class="block"> <DL><DT><B>Returns:</B></DT><DD>whether <a href='#close()'>close()</a> will close the underlying <a href='#getSource()'>source</a>.</DD></DL></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/model/config/GormMappingConfigurationStrategy.html#isCollectionType(java.lang.Class)" title="Method in GormMappingConfigurationStrategy">isCollectionType(java.lang.Class)</a></span> - Method in <a href="org/grails/datastore/mapping/model/config/GormMappingConfigurationStrategy.html">GormMappingConfigurationStrategy</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/gorm/services/implementers/AbstractArrayOrIterableResultImplementer.html#isCompatibleReturnType(org.codehaus.groovy.ast.ClassNode, org.codehaus.groovy.ast.MethodNode, org.codehaus.groovy.ast.ClassNode, java.lang.String)" title="Method in AbstractArrayOrIterableResultImplementer">isCompatibleReturnType(org.codehaus.groovy.ast.ClassNode, org.codehaus.groovy.ast.MethodNode, org.codehaus.groovy.ast.ClassNode, java.lang.String)</a></span> [...]
diff --git a/docs/snapshot/grails-data/hibernate5/api/org/grails/datastore/gorm/jdbc/connections/DataSourceConnectionSource.html b/docs/snapshot/grails-data/hibernate5/api/org/grails/datastore/gorm/jdbc/connections/DataSourceConnectionSource.html
index 10e1ab41bbf..04cbe77576f 100644
--- a/docs/snapshot/grails-data/hibernate5/api/org/grails/datastore/gorm/jdbc/connections/DataSourceConnectionSource.html
+++ b/docs/snapshot/grails-data/hibernate5/api/org/grails/datastore/gorm/jdbc/connections/DataSourceConnectionSource.html
@@ -132,7 +132,7 @@ extends <a href='../../../../../../org/grails/datastore/mapping/core/connections
</tr>
<tr class="altColor">
<td class="colFirst"><strong><code>class <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html'>DefaultConnectionSource</a></code></strong></td>
- <td class="colLast"><code><a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closed'>closed</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#name'>name</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#settings'>settings</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections [...]
+ <td class="colLast"><code><a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closeable'>closeable</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closed'>closed</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#name'>name</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connectio [...]
</tr>
</table>
@@ -208,7 +208,7 @@ extends <a href='../../../../../../org/grails/datastore/mapping/core/connections
<tr class="altColor">
<td class="colFirst"><code>class <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html'>DefaultConnectionSource</a></code></td>
- <td class="colLast"><code><a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#close()'>close</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getName()'>getName</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getSettings()'>getSettings</a>, <a href='../../../../../../org/grails/datastore/mapping/ [...]
+ <td class="colLast"><code><a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#close()'>close</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getName()'>getName</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getSettings()'>getSettings</a>, <a href='../../../../../../org/grails/datastore/mapping/ [...]
</tr>
</table>
</ul>
diff --git a/docs/snapshot/grails-data/hibernate5/api/org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html b/docs/snapshot/grails-data/hibernate5/api/org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html
index e88dc9bb982..e2945c7a215 100644
--- a/docs/snapshot/grails-data/hibernate5/api/org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html
+++ b/docs/snapshot/grails-data/hibernate5/api/org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html
@@ -99,7 +99,7 @@ if (location.href.indexOf('is-external=true') == -1) {
<dl>
<dt>All Implemented Interfaces and Traits:</dt>
- <dd>org.springframework.context.ApplicationContextAware</dd>
+ <dd>org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.DisposableBean</dd>
</dl>
@@ -112,7 +112,7 @@ if (location.href.indexOf('is-external=true') == -1) {
@org.springframework.boot.autoconfigure.AutoConfigureAfter(value: MongoAutoConfiguration)
class MongoDbGormAutoConfiguration
extends java.lang.Object
-implements org.springframework.context.ApplicationContextAware</pre>
+implements org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.DisposableBean</pre>
<p>
Auto configurer that configures GORM for MongoDB for use in Spring Boot <DL><DT><B>Authors:</B></DT><DD>Graeme Rocher</DD></DL><DL><DT><B>Since:</B></DT><DD>1.0</DD></DL></p>
@@ -209,18 +209,24 @@ implements org.springframework.context.ApplicationContextAware</pre>
</tr>
<tr class="altColor">
+ <td class="colFirst"><code></code></td>
+ <td class="colLast"><code>void</code></td>
+ <td class="colLast"><code><strong><a href="#destroy()">destroy</a></strong>()</code><br>Closes the MongoClient only when it was created by this auto-configuration. </td>
+ </tr>
+
+ <tr class="rowColor">
<td class="colFirst"><code></code></td>
<td class="colLast"><code><a href='../../../../../../../org/grails/datastore/mapping/mongo/MongoDatastore.html'>MongoDatastore</a></code></td>
<td class="colLast"><code><strong><a href="#mongoDatastore()">mongoDatastore</a></strong>()</code><br></td>
</tr>
- <tr class="rowColor">
+ <tr class="altColor">
<td class="colFirst"><code></code></td>
<td class="colLast"><code>org.springframework.transaction.PlatformTransactionManager</code></td>
<td class="colLast"><code><strong><a href="#mongoTransactionManager()">mongoTransactionManager</a></strong>()</code><br></td>
</tr>
- <tr class="altColor">
+ <tr class="rowColor">
<td class="colFirst"><code></code></td>
<td class="colLast"><code>void</code></td>
<td class="colLast"><code><strong><a href="#setApplicationContext(org.springframework.context.ApplicationContext)">setApplicationContext</a></strong>(org.springframework.context.ApplicationContext applicationContext)</code><br></td>
@@ -328,6 +334,17 @@ implements org.springframework.context.ApplicationContextAware</pre>
</a>
<h3>Method Detail</h3>
+ <a name="destroy()"><!-- --></a>
+ <ul class="blockListLast">
+ <li class="blockList">
+ <h4>@java.lang.Override<br>void <strong>destroy</strong>()</h4>
+ <p> Closes the MongoClient only when it was created by this auto-configuration. A client
+ supplied as an existing bean is owned by the application context (or the user) and must not be
+ closed here. The <CODE>mongoDatastore</CODE> bean is created after this configuration, so it is
+ destroyed first, leaving its sessions closed before the client itself is closed.</p>
+ </li>
+ </ul>
+
<a name="mongoDatastore()"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
diff --git a/docs/snapshot/grails-data/hibernate5/api/org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html b/docs/snapshot/grails-data/hibernate5/api/org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html
index d2eeb6ab62c..e3e2019075e 100644
--- a/docs/snapshot/grails-data/hibernate5/api/org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html
+++ b/docs/snapshot/grails-data/hibernate5/api/org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html
@@ -141,23 +141,29 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
<tr class="altColor">
<td class="colFirst"><code><strong>protected boolean</strong></code> </td>
- <td class="colLast"><code><a href="#closed">closed</a></code></td>
+ <td class="colLast"><code><a href="#closeable">closeable</a></code></td>
<td class="colLast"></td>
</tr>
<tr class="rowColor">
+ <td class="colFirst"><code><strong>protected boolean</strong></code> </td>
+ <td class="colLast"><code><a href="#closed">closed</a></code></td>
+ <td class="colLast"></td>
+ </tr>
+
+ <tr class="altColor">
<td class="colFirst"><code><strong>protected java.lang.String</strong></code> </td>
<td class="colLast"><code><a href="#name">name</a></code></td>
<td class="colLast"></td>
</tr>
- <tr class="altColor">
+ <tr class="rowColor">
<td class="colFirst"><code><strong>protected S</strong></code> </td>
<td class="colLast"><code><a href="#settings">settings</a></code></td>
<td class="colLast"></td>
</tr>
- <tr class="rowColor">
+ <tr class="altColor">
<td class="colFirst"><code><strong>protected T</strong></code> </td>
<td class="colLast"><code><a href="#source">source</a></code></td>
<td class="colLast"></td>
@@ -193,6 +199,11 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
<code><strong><a href="#DefaultConnectionSource(java.lang.String, T, S)">DefaultConnectionSource</a></strong>(java.lang.String name, T source, S settings)</code><br></td>
</tr>
+ <tr class="rowColor">
+ <td class="colFirst">
+ <code><strong><a href="#DefaultConnectionSource(java.lang.String, T, S, boolean)">DefaultConnectionSource</a></strong>(java.lang.String name, T source, S settings, boolean closeable)</code><br>Creates a connection source, optionally taking ownership of the underlying source.</td>
+ </tr>
+
</table>
</ul>
</li>
@@ -238,6 +249,12 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
<td class="colLast"><code><strong><a href="#getSource()">getSource</a></strong>()</code><br></td>
</tr>
+ <tr class="altColor">
+ <td class="colFirst"><code></code></td>
+ <td class="colLast"><code>public boolean</code></td>
+ <td class="colLast"><code><strong><a href="#isCloseable()">isCloseable</a></strong>()</code><br> <DL><DT><B>Returns:</B></DT><DD>whether <a href='#close()'>close()</a> will close the underlying <a href='#getSource()'>source</a>.</DD></DL></td>
+ </tr>
+
</table>
</ul>
</li>
@@ -279,6 +296,14 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
</a>
<h3>Field Detail</h3>
+ <a name="closeable"><!-- --></a>
+ <ul class="blockListLast">
+ <li class="blockList">
+ <h4>protected final boolean <strong>closeable</strong></h4>
+ <p></p>
+ </li>
+ </ul>
+
<a name="closed"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
@@ -335,6 +360,18 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
</li>
</ul>
+ <a name="DefaultConnectionSource(java.lang.String, T, S, boolean)"><!-- --></a>
+ <ul class="blockListLast">
+ <li class="blockList">
+ <h4>public <strong>DefaultConnectionSource</strong>(java.lang.String name, T source, S settings, boolean closeable)</h4>
+ <p> Creates a connection source, optionally taking ownership of the underlying source.
+ <DL><DT><B>Parameters:</B></DT><DD><code>name</code> - the name of the connection source</DD><DD><code>source</code> - the underlying native source (for example a <CODE>MongoClient</CODE> or <CODE>DataSource</CODE>)</DD><DD><code>settings</code> - the settings</DD><DD><code>closeable</code> - whether <a href='#close()'>close()</a> should close the underlying <CODE>source</CODE>. Pass
+ <CODE>false</CODE> when the source is externally managed and its lifecycle is owned
+ by the provider (for example a Spring-managed <CODE>MongoClient</CODE> bean), so that
+ GORM does not close a source it did not create.</DD></DL><DL><DT><B>Since:</B></DT><DD>8.0</DD></DL></p>
+ </li>
+ </ul>
+
</li>
</ul>
@@ -380,6 +417,17 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
</li>
</ul>
+ <a name="isCloseable()"><!-- --></a>
+ <ul class="blockListLast">
+ <li class="blockList">
+ <h4>public boolean <strong>isCloseable</strong>()</h4>
+ <p>
+ <DL><DT><B>Returns:</B></DT><DD>whether <a href='#close()'>close()</a> will close the underlying <a href='#getSource()'>source</a>. When
+ <CODE>false</CODE> the source is externally managed and its lifecycle is owned by the provider, so
+ GORM will not close it.</DD></DL><DL><DT><B>Since:</B></DT><DD>8.0</DD></DL></p>
+ </li>
+ </ul>
+
</li>
</ul>
diff --git a/docs/snapshot/grails-data/hibernate5/api/org/grails/datastore/mapping/mongo/MongoDatastore.html b/docs/snapshot/grails-data/hibernate5/api/org/grails/datastore/mapping/mongo/MongoDatastore.html
index c82ec0147d6..f21ade1f669 100644
--- a/docs/snapshot/grails-data/hibernate5/api/org/grails/datastore/mapping/mongo/MongoDatastore.html
+++ b/docs/snapshot/grails-data/hibernate5/api/org/grails/datastore/mapping/mongo/MongoDatastore.html
@@ -521,7 +521,7 @@ implements <a href='../../../../../MappingContextListener.html'>MappingContextLi
<tr class="altColor">
<td class="colFirst"><code></code></td>
<td class="colLast"><code>protected static <a href='../../../../../org/grails/datastore/mapping/core/connections/ConnectionSources.html' title='ConnectionSources'>ConnectionSources</a><MongoClient, <a href='../../../../../org/grails/datastore/mapping/mongo/connections/MongoConnectionSourceSettings.html' title='MongoConnectionSourceSettings'>MongoConnectionSourceSettings</a>></code></td>
- <td class="colLast"><code><strong><a href="#createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext)">createDefaultConnectionSources</a></strong>(<a href='../../../../../com.mongodb.client.MongoClient.html'>MongoClient</a> mongoClient, org.springframework.core.env.PropertyResolver configuration, <a href='../../../../../org/grails/datastore/mappin [...]
+ <td class="colLast"><code><strong><a href="#createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext, boolean)">createDefaultConnectionSources</a></strong>(<a href='../../../../../com.mongodb.client.MongoClient.html'>MongoClient</a> mongoClient, org.springframework.core.env.PropertyResolver configuration, <a href='../../../../../org/grails/datasto [...]
</tr>
<tr class="rowColor">
@@ -1346,12 +1346,15 @@ implements <a href='../../../../../MappingContextListener.html'>MappingContextLi
</li>
</ul>
- <a name="createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext)"><!-- --></a>
+ <a name="createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext, boolean)"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
- <h4>protected static <a href='../../../../../org/grails/datastore/mapping/core/connections/ConnectionSources.html' title='ConnectionSources'>ConnectionSources</a><MongoClient, <a href='../../../../../org/grails/datastore/mapping/mongo/connections/MongoConnectionSourceSettings.html' title='MongoConnectionSourceSettings'>MongoConnectionSourceSettings</a>> <strong>createDefaultConnectionSources</strong>(<a href='../../../../../com.mongodb.clie [...]
- <p> Creates the connection sources for an existing MongoClient
- <DL><DT><B>Parameters:</B></DT><DD><code>mongoClient</code> - The MongoClient</DD><DD><code>configuration</code> - The configuration</DD><DD><code>mappingContext</code> - The <a href='../../../../../org/grails/datastore/mapping/mongo/config/MongoMappingContext.html' title='MongoMappingContext'>MongoMappingContext</a></DD></DL><DL><DT><B>Returns:</B></DT><DD>The <a href='../../../../../org/grails/datastore/mapping/core/connections/ConnectionSources.html' title='ConnectionSources' [...]
+ <h4>protected static <a href='../../../../../org/grails/datastore/mapping/core/connections/ConnectionSources.html' title='ConnectionSources'>ConnectionSources</a><MongoClient, <a href='../../../../../org/grails/datastore/mapping/mongo/connections/MongoConnectionSourceSettings.html' title='MongoConnectionSourceSettings'>MongoConnectionSourceSettings</a>> <strong>createDefaultConnectionSources</strong>(<a href='../../../../../com.mongodb.clie [...]
+ <p> Creates the connection sources for a MongoClient.
+ <DL><DT><B>Parameters:</B></DT><DD><code>mongoClient</code> - The MongoClient</DD><DD><code>configuration</code> - The configuration</DD><DD><code>mappingContext</code> - The <a href='../../../../../org/grails/datastore/mapping/mongo/config/MongoMappingContext.html' title='MongoMappingContext'>MongoMappingContext</a></DD><DD><code>closeable</code> - whether GORM owns the client and should close it on shutdown. Pass
+ <CODE>false</CODE> for an externally-supplied client (its lifecycle is owned by the
+ caller, e.g. a Spring-managed bean) and <CODE>true</CODE> for a client GORM created
+ itself, so it is not leaked.</DD></DL><DL><DT><B>Returns:</B></DT><DD>The <a href='../../../../../org/grails/datastore/mapping/core/connections/ConnectionSources.html' title='ConnectionSources'>ConnectionSources</a></DD></DL></p>
</li>
</ul>
diff --git a/docs/snapshot/grails-data/hibernate5/api/org/grails/orm/hibernate/connections/HibernateConnectionSource.html b/docs/snapshot/grails-data/hibernate5/api/org/grails/orm/hibernate/connections/HibernateConnectionSource.html
index 19ad4a74fa6..c74febb2d6d 100644
--- a/docs/snapshot/grails-data/hibernate5/api/org/grails/orm/hibernate/connections/HibernateConnectionSource.html
+++ b/docs/snapshot/grails-data/hibernate5/api/org/grails/orm/hibernate/connections/HibernateConnectionSource.html
@@ -154,7 +154,7 @@ extends <a href='../../../../../org/grails/datastore/mapping/core/connections/De
</tr>
<tr class="altColor">
<td class="colFirst"><strong><code>class <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html'>DefaultConnectionSource</a></code></strong></td>
- <td class="colLast"><code><a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closed'>closed</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#name'>name</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#settings'>settings</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConn [...]
+ <td class="colLast"><code><a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closeable'>closeable</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closed'>closed</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#name'>name</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultCo [...]
</tr>
</table>
@@ -236,7 +236,7 @@ extends <a href='../../../../../org/grails/datastore/mapping/core/connections/De
<tr class="altColor">
<td class="colFirst"><code>class <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html'>DefaultConnectionSource</a></code></td>
- <td class="colLast"><code><a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#close()'>close</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getName()'>getName</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getSettings()'>getSettings</a>, <a href='../../../../../org/grails/datastore/mapping/core/connect [...]
+ <td class="colLast"><code><a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#close()'>close</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getName()'>getName</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getSettings()'>getSettings</a>, <a href='../../../../../org/grails/datastore/mapping/core/connect [...]
</tr>
</table>
</ul>
diff --git a/docs/snapshot/grails-data/hibernate7/api/index-all.html b/docs/snapshot/grails-data/hibernate7/api/index-all.html
index 1166afd4c88..85394ecd239 100644
--- a/docs/snapshot/grails-data/hibernate7/api/index-all.html
+++ b/docs/snapshot/grails-data/hibernate7/api/index-all.html
@@ -2059,6 +2059,8 @@ if (location.href.indexOf('is-external=true') == -1) {
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/gorm/jdbc/MultiTenantConnection.html#close()" title="Method in MultiTenantConnection">close()</a></span> - Method in <a href="org/grails/datastore/gorm/jdbc/MultiTenantConnection.html">MultiTenantConnection</a>
</dt><dd> <div class="block"></div></dd>
+<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closeable" title="Field in DefaultConnectionSource">closeable</a></span> - Field in <a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html">DefaultConnectionSource</a>
+</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closed" title="Field in DefaultConnectionSource">closed</a></span> - Field in <a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html">DefaultConnectionSource</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/plugins/databasemigration/liquibase/GroovyChange.1.html#closeResources(java.sql.Connection)" title="Method in GroovyChange.1">closeResources(java.sql.Connection)</a></span> - Method in <a href="org/grails/plugins/databasemigration/liquibase/GroovyChange.1.html">GroovyChange.1</a>
@@ -3117,8 +3119,8 @@ if (location.href.indexOf('is-external=true') == -1) {
<dt><span class="strong"><a href="grails/gorm/annotation/CreatedDate.html" title="Annotation Type in grails.gorm.annotation">CreatedDate</a></span> - Annotation Type in <a href="./grails/gorm/annotation/package-summary.html">grails.gorm.annotation</a>
</dt><dd><div class="block">A property annotation used to apply auto-timestamping on a field
upon gorm insert events. </div></dd>
-<dt><span class="strong"><a href="org/grails/datastore/mapping/mongo/MongoDatastore.html#createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext)" title="Method in MongoDatastore">createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext)</a></span> - Method in [...]
-</dt><dd> <div class="block">Creates the connection sources for an existing MongoClient</div></dd>
+<dt><span class="strong"><a href="org/grails/datastore/mapping/mongo/MongoDatastore.html#createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext, boolean)" title="Method in MongoDatastore">createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext, boolean)</a></ [...]
+</dt><dd> <div class="block">Creates the connection sources for a MongoClient.</div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/model/MappingFactory.html#createDefaultIdentityMapping(org.grails.datastore.mapping.model.ClassMapping, T)" title="Method in MappingFactory">createDefaultIdentityMapping(org.grails.datastore.mapping.model.ClassMapping, T)</a></span> - Method in <a href="org/grails/datastore/mapping/model/MappingFactory.html">MappingFactory</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/gorm/transform/AbstractMethodDecoratingTransformation.html#createDelegingMethodBody(org.codehaus.groovy.ast.Parameter, org.codehaus.groovy.ast.expr.MethodCallExpression)" title="Method in AbstractMethodDecoratingTransformation">createDelegingMethodBody(org.codehaus.groovy.ast.Parameter, org.codehaus.groovy.ast.expr.MethodCallExpression)</a></span> - Method in <a href="org/grails/datastore/gorm/transform/AbstractMethodDecoratingTransf [...]
@@ -3983,8 +3985,8 @@ if (location.href.indexOf('is-external=true') == -1) {
</dt><dd><div class="block">Abstract implementation of the <a href='../../../../../../org/grails/datastore/mapping/core/connections/ConnectionSource.html' title='ConnectionSource'>ConnectionSource</a> interface</div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/AbstractConnectionSources.html#defaultConnectionSource" title="Field in AbstractConnectionSources">defaultConnectionSource</a></span> - Field in <a href="org/grails/datastore/mapping/core/connections/AbstractConnectionSources.html">AbstractConnectionSources</a>
</dt><dd> <div class="block"></div></dd>
-<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#DefaultConnectionSource(java.lang.String, T, S)" title="Constructor in DefaultConnectionSource">DefaultConnectionSource(java.lang.String, T, S)</a></span> - Constructor in <a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html">DefaultConnectionSource</a>
-</dt><dd> <div class="block"></div></dd>
+<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#DefaultConnectionSource(java.lang.String, T, S, boolean)" title="Constructor in DefaultConnectionSource">DefaultConnectionSource(java.lang.String, T, S, boolean)</a></span> - Constructor in <a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html">DefaultConnectionSource</a>
+</dt><dd> <div class="block">Creates a connection source, optionally taking ownership of the underlying source.</div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/config/AbstractGormMappingFactory.html#defaultConstraints" title="Field in AbstractGormMappingFactory">defaultConstraints</a></span> - Field in <a href="org/grails/datastore/mapping/config/AbstractGormMappingFactory.html">AbstractGormMappingFactory</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/orm/hibernate/cfg/HibernateMappingBuilder.html#defaultConstraints" title="Property in HibernateMappingBuilder">defaultConstraints</a></span> - Property in <a href="org/grails/orm/hibernate/cfg/HibernateMappingBuilder.html">HibernateMappingBuilder</a>
@@ -4322,6 +4324,8 @@ if (location.href.indexOf('is-external=true') == -1) {
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/plugin/hibernate/support/HibernatePersistenceContextInterceptor.html#destroy()" title="Method in HibernatePersistenceContextInterceptor">destroy()</a></span> - Method in <a href="org/grails/plugin/hibernate/support/HibernatePersistenceContextInterceptor.html">HibernatePersistenceContextInterceptor</a>
</dt><dd> <div class="block"></div></dd>
+<dt><span class="strong"><a href="org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html#destroy()" title="Method in MongoDbGormAutoConfiguration">destroy()</a></span> - Method in <a href="org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html">MongoDbGormAutoConfiguration</a>
+</dt><dd> <div class="block">Closes the MongoClient only when it was created by this auto-configuration. </div></dd>
<dt><span class="strong"><a href="org/grails/datastore/gorm/services/implementers/AbstractDetachedCriteriaServiceImplementor.html#DETACHED_CRITERIA" title="Field in AbstractDetachedCriteriaServiceImplementor">DETACHED_CRITERIA</a></span> - Field in <a href="org/grails/datastore/gorm/services/implementers/AbstractDetachedCriteriaServiceImplementor.html">AbstractDetachedCriteriaServiceImplementor</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/gorm/query/transform/DetachedCriteriaTransformer.html#DETACHED_CRITERIA_CLASS_NODE" title="Field in DetachedCriteriaTransformer">DETACHED_CRITERIA_CLASS_NODE</a></span> - Field in <a href="org/grails/datastore/gorm/query/transform/DetachedCriteriaTransformer.html">DetachedCriteriaTransformer</a>
@@ -10279,6 +10283,8 @@ if (location.href.indexOf('is-external=true') == -1) {
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/reflect/ClassUtils.html#isClassBelowPackage(Class<?>, java.util.List)" title="Method in ClassUtils">isClassBelowPackage(Class<?>, java.util.List)</a></span> - Method in <a href="org/grails/datastore/mapping/reflect/ClassUtils.html">ClassUtils</a>
</dt><dd> <div class="block"></div></dd>
+<dt><span class="strong"><a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#isCloseable()" title="Method in DefaultConnectionSource">isCloseable()</a></span> - Method in <a href="org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html">DefaultConnectionSource</a>
+</dt><dd> <div class="block"> <DL><DT><B>Returns:</B></DT><DD>whether <a href='#close()'>close()</a> will close the underlying <a href='#getSource()'>source</a>.</DD></DL></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/model/config/GormMappingConfigurationStrategy.html#isCollectionType(java.lang.Class)" title="Method in GormMappingConfigurationStrategy">isCollectionType(java.lang.Class)</a></span> - Method in <a href="org/grails/datastore/mapping/model/config/GormMappingConfigurationStrategy.html">GormMappingConfigurationStrategy</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/gorm/services/implementers/AbstractArrayOrIterableResultImplementer.html#isCompatibleReturnType(org.codehaus.groovy.ast.ClassNode, org.codehaus.groovy.ast.MethodNode, org.codehaus.groovy.ast.ClassNode, java.lang.String)" title="Method in AbstractArrayOrIterableResultImplementer">isCompatibleReturnType(org.codehaus.groovy.ast.ClassNode, org.codehaus.groovy.ast.MethodNode, org.codehaus.groovy.ast.ClassNode, java.lang.String)</a></span> [...]
diff --git a/docs/snapshot/grails-data/hibernate7/api/org/grails/datastore/gorm/jdbc/connections/DataSourceConnectionSource.html b/docs/snapshot/grails-data/hibernate7/api/org/grails/datastore/gorm/jdbc/connections/DataSourceConnectionSource.html
index 15593ab7f5d..b7ca736f1b2 100644
--- a/docs/snapshot/grails-data/hibernate7/api/org/grails/datastore/gorm/jdbc/connections/DataSourceConnectionSource.html
+++ b/docs/snapshot/grails-data/hibernate7/api/org/grails/datastore/gorm/jdbc/connections/DataSourceConnectionSource.html
@@ -132,7 +132,7 @@ extends <a href='../../../../../../org/grails/datastore/mapping/core/connections
</tr>
<tr class="altColor">
<td class="colFirst"><strong><code>class <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html'>DefaultConnectionSource</a></code></strong></td>
- <td class="colLast"><code><a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closed'>closed</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#name'>name</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#settings'>settings</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections [...]
+ <td class="colLast"><code><a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closeable'>closeable</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closed'>closed</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#name'>name</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connectio [...]
</tr>
</table>
@@ -208,7 +208,7 @@ extends <a href='../../../../../../org/grails/datastore/mapping/core/connections
<tr class="altColor">
<td class="colFirst"><code>class <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html'>DefaultConnectionSource</a></code></td>
- <td class="colLast"><code><a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#close()'>close</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getName()'>getName</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getSettings()'>getSettings</a>, <a href='../../../../../../org/grails/datastore/mapping/ [...]
+ <td class="colLast"><code><a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#close()'>close</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getName()'>getName</a>, <a href='../../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getSettings()'>getSettings</a>, <a href='../../../../../../org/grails/datastore/mapping/ [...]
</tr>
</table>
</ul>
diff --git a/docs/snapshot/grails-data/hibernate7/api/org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html b/docs/snapshot/grails-data/hibernate7/api/org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html
index 4808a0f1bf7..7d86145db8a 100644
--- a/docs/snapshot/grails-data/hibernate7/api/org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html
+++ b/docs/snapshot/grails-data/hibernate7/api/org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html
@@ -99,7 +99,7 @@ if (location.href.indexOf('is-external=true') == -1) {
<dl>
<dt>All Implemented Interfaces and Traits:</dt>
- <dd>org.springframework.context.ApplicationContextAware</dd>
+ <dd>org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.DisposableBean</dd>
</dl>
@@ -112,7 +112,7 @@ if (location.href.indexOf('is-external=true') == -1) {
@org.springframework.boot.autoconfigure.AutoConfigureAfter(value: MongoAutoConfiguration)
class MongoDbGormAutoConfiguration
extends java.lang.Object
-implements org.springframework.context.ApplicationContextAware</pre>
+implements org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.DisposableBean</pre>
<p>
Auto configurer that configures GORM for MongoDB for use in Spring Boot <DL><DT><B>Authors:</B></DT><DD>Graeme Rocher</DD></DL><DL><DT><B>Since:</B></DT><DD>1.0</DD></DL></p>
@@ -209,18 +209,24 @@ implements org.springframework.context.ApplicationContextAware</pre>
</tr>
<tr class="altColor">
+ <td class="colFirst"><code></code></td>
+ <td class="colLast"><code>void</code></td>
+ <td class="colLast"><code><strong><a href="#destroy()">destroy</a></strong>()</code><br>Closes the MongoClient only when it was created by this auto-configuration. </td>
+ </tr>
+
+ <tr class="rowColor">
<td class="colFirst"><code></code></td>
<td class="colLast"><code><a href='../../../../../../../org/grails/datastore/mapping/mongo/MongoDatastore.html'>MongoDatastore</a></code></td>
<td class="colLast"><code><strong><a href="#mongoDatastore()">mongoDatastore</a></strong>()</code><br></td>
</tr>
- <tr class="rowColor">
+ <tr class="altColor">
<td class="colFirst"><code></code></td>
<td class="colLast"><code>org.springframework.transaction.PlatformTransactionManager</code></td>
<td class="colLast"><code><strong><a href="#mongoTransactionManager()">mongoTransactionManager</a></strong>()</code><br></td>
</tr>
- <tr class="altColor">
+ <tr class="rowColor">
<td class="colFirst"><code></code></td>
<td class="colLast"><code>void</code></td>
<td class="colLast"><code><strong><a href="#setApplicationContext(org.springframework.context.ApplicationContext)">setApplicationContext</a></strong>(org.springframework.context.ApplicationContext applicationContext)</code><br></td>
@@ -328,6 +334,17 @@ implements org.springframework.context.ApplicationContextAware</pre>
</a>
<h3>Method Detail</h3>
+ <a name="destroy()"><!-- --></a>
+ <ul class="blockListLast">
+ <li class="blockList">
+ <h4>@java.lang.Override<br>void <strong>destroy</strong>()</h4>
+ <p> Closes the MongoClient only when it was created by this auto-configuration. A client
+ supplied as an existing bean is owned by the application context (or the user) and must not be
+ closed here. The <CODE>mongoDatastore</CODE> bean is created after this configuration, so it is
+ destroyed first, leaving its sessions closed before the client itself is closed.</p>
+ </li>
+ </ul>
+
<a name="mongoDatastore()"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
diff --git a/docs/snapshot/grails-data/hibernate7/api/org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html b/docs/snapshot/grails-data/hibernate7/api/org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html
index e0094cbb087..66b07abcecd 100644
--- a/docs/snapshot/grails-data/hibernate7/api/org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html
+++ b/docs/snapshot/grails-data/hibernate7/api/org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html
@@ -141,23 +141,29 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
<tr class="altColor">
<td class="colFirst"><code><strong>protected boolean</strong></code> </td>
- <td class="colLast"><code><a href="#closed">closed</a></code></td>
+ <td class="colLast"><code><a href="#closeable">closeable</a></code></td>
<td class="colLast"></td>
</tr>
<tr class="rowColor">
+ <td class="colFirst"><code><strong>protected boolean</strong></code> </td>
+ <td class="colLast"><code><a href="#closed">closed</a></code></td>
+ <td class="colLast"></td>
+ </tr>
+
+ <tr class="altColor">
<td class="colFirst"><code><strong>protected java.lang.String</strong></code> </td>
<td class="colLast"><code><a href="#name">name</a></code></td>
<td class="colLast"></td>
</tr>
- <tr class="altColor">
+ <tr class="rowColor">
<td class="colFirst"><code><strong>protected S</strong></code> </td>
<td class="colLast"><code><a href="#settings">settings</a></code></td>
<td class="colLast"></td>
</tr>
- <tr class="rowColor">
+ <tr class="altColor">
<td class="colFirst"><code><strong>protected T</strong></code> </td>
<td class="colLast"><code><a href="#source">source</a></code></td>
<td class="colLast"></td>
@@ -193,6 +199,11 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
<code><strong><a href="#DefaultConnectionSource(java.lang.String, T, S)">DefaultConnectionSource</a></strong>(java.lang.String name, T source, S settings)</code><br></td>
</tr>
+ <tr class="rowColor">
+ <td class="colFirst">
+ <code><strong><a href="#DefaultConnectionSource(java.lang.String, T, S, boolean)">DefaultConnectionSource</a></strong>(java.lang.String name, T source, S settings, boolean closeable)</code><br>Creates a connection source, optionally taking ownership of the underlying source.</td>
+ </tr>
+
</table>
</ul>
</li>
@@ -238,6 +249,12 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
<td class="colLast"><code><strong><a href="#getSource()">getSource</a></strong>()</code><br></td>
</tr>
+ <tr class="altColor">
+ <td class="colFirst"><code></code></td>
+ <td class="colLast"><code>public boolean</code></td>
+ <td class="colLast"><code><strong><a href="#isCloseable()">isCloseable</a></strong>()</code><br> <DL><DT><B>Returns:</B></DT><DD>whether <a href='#close()'>close()</a> will close the underlying <a href='#getSource()'>source</a>.</DD></DL></td>
+ </tr>
+
</table>
</ul>
</li>
@@ -279,6 +296,14 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
</a>
<h3>Field Detail</h3>
+ <a name="closeable"><!-- --></a>
+ <ul class="blockListLast">
+ <li class="blockList">
+ <h4>protected final boolean <strong>closeable</strong></h4>
+ <p></p>
+ </li>
+ </ul>
+
<a name="closed"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
@@ -335,6 +360,18 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
</li>
</ul>
+ <a name="DefaultConnectionSource(java.lang.String, T, S, boolean)"><!-- --></a>
+ <ul class="blockListLast">
+ <li class="blockList">
+ <h4>public <strong>DefaultConnectionSource</strong>(java.lang.String name, T source, S settings, boolean closeable)</h4>
+ <p> Creates a connection source, optionally taking ownership of the underlying source.
+ <DL><DT><B>Parameters:</B></DT><DD><code>name</code> - the name of the connection source</DD><DD><code>source</code> - the underlying native source (for example a <CODE>MongoClient</CODE> or <CODE>DataSource</CODE>)</DD><DD><code>settings</code> - the settings</DD><DD><code>closeable</code> - whether <a href='#close()'>close()</a> should close the underlying <CODE>source</CODE>. Pass
+ <CODE>false</CODE> when the source is externally managed and its lifecycle is owned
+ by the provider (for example a Spring-managed <CODE>MongoClient</CODE> bean), so that
+ GORM does not close a source it did not create.</DD></DL><DL><DT><B>Since:</B></DT><DD>8.0</DD></DL></p>
+ </li>
+ </ul>
+
</li>
</ul>
@@ -380,6 +417,17 @@ implements <a href='../../../../../../org/grails/datastore/mapping/core/connecti
</li>
</ul>
+ <a name="isCloseable()"><!-- --></a>
+ <ul class="blockListLast">
+ <li class="blockList">
+ <h4>public boolean <strong>isCloseable</strong>()</h4>
+ <p>
+ <DL><DT><B>Returns:</B></DT><DD>whether <a href='#close()'>close()</a> will close the underlying <a href='#getSource()'>source</a>. When
+ <CODE>false</CODE> the source is externally managed and its lifecycle is owned by the provider, so
+ GORM will not close it.</DD></DL><DL><DT><B>Since:</B></DT><DD>8.0</DD></DL></p>
+ </li>
+ </ul>
+
</li>
</ul>
diff --git a/docs/snapshot/grails-data/hibernate7/api/org/grails/datastore/mapping/mongo/MongoDatastore.html b/docs/snapshot/grails-data/hibernate7/api/org/grails/datastore/mapping/mongo/MongoDatastore.html
index 020da0cb779..35654406c58 100644
--- a/docs/snapshot/grails-data/hibernate7/api/org/grails/datastore/mapping/mongo/MongoDatastore.html
+++ b/docs/snapshot/grails-data/hibernate7/api/org/grails/datastore/mapping/mongo/MongoDatastore.html
@@ -521,7 +521,7 @@ implements <a href='../../../../../MappingContextListener.html'>MappingContextLi
<tr class="altColor">
<td class="colFirst"><code></code></td>
<td class="colLast"><code>protected static <a href='../../../../../org/grails/datastore/mapping/core/connections/ConnectionSources.html' title='ConnectionSources'>ConnectionSources</a><MongoClient, <a href='../../../../../org/grails/datastore/mapping/mongo/connections/MongoConnectionSourceSettings.html' title='MongoConnectionSourceSettings'>MongoConnectionSourceSettings</a>></code></td>
- <td class="colLast"><code><strong><a href="#createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext)">createDefaultConnectionSources</a></strong>(<a href='../../../../../com.mongodb.client.MongoClient.html'>MongoClient</a> mongoClient, org.springframework.core.env.PropertyResolver configuration, <a href='../../../../../org/grails/datastore/mappin [...]
+ <td class="colLast"><code><strong><a href="#createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext, boolean)">createDefaultConnectionSources</a></strong>(<a href='../../../../../com.mongodb.client.MongoClient.html'>MongoClient</a> mongoClient, org.springframework.core.env.PropertyResolver configuration, <a href='../../../../../org/grails/datasto [...]
</tr>
<tr class="rowColor">
@@ -1346,12 +1346,15 @@ implements <a href='../../../../../MappingContextListener.html'>MappingContextLi
</li>
</ul>
- <a name="createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext)"><!-- --></a>
+ <a name="createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext, boolean)"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
- <h4>protected static <a href='../../../../../org/grails/datastore/mapping/core/connections/ConnectionSources.html' title='ConnectionSources'>ConnectionSources</a><MongoClient, <a href='../../../../../org/grails/datastore/mapping/mongo/connections/MongoConnectionSourceSettings.html' title='MongoConnectionSourceSettings'>MongoConnectionSourceSettings</a>> <strong>createDefaultConnectionSources</strong>(<a href='../../../../../com.mongodb.clie [...]
- <p> Creates the connection sources for an existing MongoClient
- <DL><DT><B>Parameters:</B></DT><DD><code>mongoClient</code> - The MongoClient</DD><DD><code>configuration</code> - The configuration</DD><DD><code>mappingContext</code> - The <a href='../../../../../org/grails/datastore/mapping/mongo/config/MongoMappingContext.html' title='MongoMappingContext'>MongoMappingContext</a></DD></DL><DL><DT><B>Returns:</B></DT><DD>The <a href='../../../../../org/grails/datastore/mapping/core/connections/ConnectionSources.html' title='ConnectionSources' [...]
+ <h4>protected static <a href='../../../../../org/grails/datastore/mapping/core/connections/ConnectionSources.html' title='ConnectionSources'>ConnectionSources</a><MongoClient, <a href='../../../../../org/grails/datastore/mapping/mongo/connections/MongoConnectionSourceSettings.html' title='MongoConnectionSourceSettings'>MongoConnectionSourceSettings</a>> <strong>createDefaultConnectionSources</strong>(<a href='../../../../../com.mongodb.clie [...]
+ <p> Creates the connection sources for a MongoClient.
+ <DL><DT><B>Parameters:</B></DT><DD><code>mongoClient</code> - The MongoClient</DD><DD><code>configuration</code> - The configuration</DD><DD><code>mappingContext</code> - The <a href='../../../../../org/grails/datastore/mapping/mongo/config/MongoMappingContext.html' title='MongoMappingContext'>MongoMappingContext</a></DD><DD><code>closeable</code> - whether GORM owns the client and should close it on shutdown. Pass
+ <CODE>false</CODE> for an externally-supplied client (its lifecycle is owned by the
+ caller, e.g. a Spring-managed bean) and <CODE>true</CODE> for a client GORM created
+ itself, so it is not leaked.</DD></DL><DL><DT><B>Returns:</B></DT><DD>The <a href='../../../../../org/grails/datastore/mapping/core/connections/ConnectionSources.html' title='ConnectionSources'>ConnectionSources</a></DD></DL></p>
</li>
</ul>
diff --git a/docs/snapshot/grails-data/hibernate7/api/org/grails/orm/hibernate/connections/HibernateConnectionSource.html b/docs/snapshot/grails-data/hibernate7/api/org/grails/orm/hibernate/connections/HibernateConnectionSource.html
index 0bad77fe12b..a89c9986a56 100644
--- a/docs/snapshot/grails-data/hibernate7/api/org/grails/orm/hibernate/connections/HibernateConnectionSource.html
+++ b/docs/snapshot/grails-data/hibernate7/api/org/grails/orm/hibernate/connections/HibernateConnectionSource.html
@@ -154,7 +154,7 @@ extends <a href='../../../../../org/grails/datastore/mapping/core/connections/De
</tr>
<tr class="altColor">
<td class="colFirst"><strong><code>class <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html'>DefaultConnectionSource</a></code></strong></td>
- <td class="colLast"><code><a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closed'>closed</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#name'>name</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#settings'>settings</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConn [...]
+ <td class="colLast"><code><a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closeable'>closeable</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#closed'>closed</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#name'>name</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultCo [...]
</tr>
</table>
@@ -236,7 +236,7 @@ extends <a href='../../../../../org/grails/datastore/mapping/core/connections/De
<tr class="altColor">
<td class="colFirst"><code>class <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html'>DefaultConnectionSource</a></code></td>
- <td class="colLast"><code><a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#close()'>close</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getName()'>getName</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getSettings()'>getSettings</a>, <a href='../../../../../org/grails/datastore/mapping/core/connect [...]
+ <td class="colLast"><code><a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#close()'>close</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getName()'>getName</a>, <a href='../../../../../org/grails/datastore/mapping/core/connections/DefaultConnectionSource.html#getSettings()'>getSettings</a>, <a href='../../../../../org/grails/datastore/mapping/core/connect [...]
</tr>
</table>
</ul>
diff --git a/docs/snapshot/grails-data/mongodb/api/index-all.html b/docs/snapshot/grails-data/mongodb/api/index-all.html
index cdba3c75350..1a88877f553 100644
--- a/docs/snapshot/grails-data/mongodb/api/index-all.html
+++ b/docs/snapshot/grails-data/mongodb/api/index-all.html
@@ -1705,8 +1705,8 @@ if (location.href.indexOf('is-external=true') == -1) {
</dt><dd> <div class="block">Called from the check closure.</div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/mongo/engine/MongoEntityPersister.html#createDBObjectWithKey(java.lang.Object)" title="Method in MongoEntityPersister">createDBObjectWithKey(java.lang.Object)</a></span> - Method in <a href="org/grails/datastore/mapping/mongo/engine/MongoEntityPersister.html">MongoEntityPersister</a>
</dt><dd> <div class="block"></div></dd>
-<dt><span class="strong"><a href="org/grails/datastore/mapping/mongo/MongoDatastore.html#createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext)" title="Method in MongoDatastore">createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext)</a></span> - Method in [...]
-</dt><dd> <div class="block">Creates the connection sources for an existing com.mongodb.client.MongoClient</div></dd>
+<dt><span class="strong"><a href="org/grails/datastore/mapping/mongo/MongoDatastore.html#createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext, boolean)" title="Method in MongoDatastore">createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext, boolean)</a></ [...]
+</dt><dd> <div class="block">Creates the connection sources for a com.mongodb.client.MongoClient.</div></dd>
<dt><span class="strong"><a href="org/grails/orm/hibernate/support/HibernateDialectDetectorFactoryBean.html#createDialectFactory()" title="Method in HibernateDialectDetectorFactoryBean">createDialectFactory()</a></span> - Method in <a href="org/grails/orm/hibernate/support/HibernateDialectDetectorFactoryBean.html">HibernateDialectDetectorFactoryBean</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/datastore/mapping/mongo/config/MongoMappingContext.html#createDocumentMappingFactory(groovy.lang.Closure)" title="Method in MongoMappingContext">createDocumentMappingFactory(groovy.lang.Closure)</a></span> - Method in <a href="org/grails/datastore/mapping/mongo/config/MongoMappingContext.html">MongoMappingContext</a>
@@ -2478,6 +2478,8 @@ if (location.href.indexOf('is-external=true') == -1) {
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/plugin/hibernate/support/HibernatePersistenceContextInterceptor.html#destroy()" title="Method in HibernatePersistenceContextInterceptor">destroy()</a></span> - Method in <a href="org/grails/plugin/hibernate/support/HibernatePersistenceContextInterceptor.html">HibernatePersistenceContextInterceptor</a>
</dt><dd> <div class="block"></div></dd>
+<dt><span class="strong"><a href="org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html#destroy()" title="Method in MongoDbGormAutoConfiguration">destroy()</a></span> - Method in <a href="org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html">MongoDbGormAutoConfiguration</a>
+</dt><dd> <div class="block">Closes the com.mongodb.client.MongoClient only when it was created by this auto-configuration. </div></dd>
<dt><span class="strong"><a href="org/grails/orm/hibernate/query/AbstractHibernateQuery.HibernateAssociationQuery.html#detachedAssocationCriteria" title="Field in AbstractHibernateQuery.HibernateAssociationQuery">detachedAssocationCriteria</a></span> - Field in <a href="org/grails/orm/hibernate/query/AbstractHibernateQuery.HibernateAssociationQuery.html">AbstractHibernateQuery.HibernateAssociationQuery</a>
</dt><dd> <div class="block"></div></dd>
<dt><span class="strong"><a href="org/grails/orm/hibernate/query/AbstractHibernateQuery.html#detachedCriteria" title="Field in AbstractHibernateQuery">detachedCriteria</a></span> - Field in <a href="org/grails/orm/hibernate/query/AbstractHibernateQuery.html">AbstractHibernateQuery</a>
diff --git a/docs/snapshot/grails-data/mongodb/api/org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html b/docs/snapshot/grails-data/mongodb/api/org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html
index 2c13f0cd99c..93d96a89cfe 100644
--- a/docs/snapshot/grails-data/mongodb/api/org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html
+++ b/docs/snapshot/grails-data/mongodb/api/org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.html
@@ -99,7 +99,7 @@ if (location.href.indexOf('is-external=true') == -1) {
<dl>
<dt>All Implemented Interfaces and Traits:</dt>
- <dd>org.springframework.context.ApplicationContextAware</dd>
+ <dd>org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.DisposableBean</dd>
</dl>
@@ -112,7 +112,7 @@ if (location.href.indexOf('is-external=true') == -1) {
@org.springframework.boot.autoconfigure.AutoConfigureAfter(value: MongoAutoConfiguration)
class MongoDbGormAutoConfiguration
extends java.lang.Object
-implements org.springframework.context.ApplicationContextAware</pre>
+implements org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.DisposableBean</pre>
<p>
Auto configurer that configures GORM for MongoDB for use in Spring Boot <DL><DT><B>Authors:</B></DT><DD>Graeme Rocher</DD></DL><DL><DT><B>Since:</B></DT><DD>1.0</DD></DL></p>
@@ -209,18 +209,24 @@ implements org.springframework.context.ApplicationContextAware</pre>
</tr>
<tr class="altColor">
+ <td class="colFirst"><code></code></td>
+ <td class="colLast"><code>void</code></td>
+ <td class="colLast"><code><strong><a href="#destroy()">destroy</a></strong>()</code><br>Closes the com.mongodb.client.MongoClient only when it was created by this auto-configuration. </td>
+ </tr>
+
+ <tr class="rowColor">
<td class="colFirst"><code></code></td>
<td class="colLast"><code><a href='../../../../../../../org/grails/datastore/mapping/mongo/MongoDatastore.html'>MongoDatastore</a></code></td>
<td class="colLast"><code><strong><a href="#mongoDatastore()">mongoDatastore</a></strong>()</code><br></td>
</tr>
- <tr class="rowColor">
+ <tr class="altColor">
<td class="colFirst"><code></code></td>
<td class="colLast"><code>org.springframework.transaction.PlatformTransactionManager</code></td>
<td class="colLast"><code><strong><a href="#mongoTransactionManager()">mongoTransactionManager</a></strong>()</code><br></td>
</tr>
- <tr class="altColor">
+ <tr class="rowColor">
<td class="colFirst"><code></code></td>
<td class="colLast"><code>void</code></td>
<td class="colLast"><code><strong><a href="#setApplicationContext(org.springframework.context.ApplicationContext)">setApplicationContext</a></strong>(org.springframework.context.ApplicationContext applicationContext)</code><br></td>
@@ -328,6 +334,17 @@ implements org.springframework.context.ApplicationContextAware</pre>
</a>
<h3>Method Detail</h3>
+ <a name="destroy()"><!-- --></a>
+ <ul class="blockListLast">
+ <li class="blockList">
+ <h4>@java.lang.Override<br>void <strong>destroy</strong>()</h4>
+ <p> Closes the com.mongodb.client.MongoClient only when it was created by this auto-configuration. A client
+ supplied as an existing bean is owned by the application context (or the user) and must not be
+ closed here. The <CODE>mongoDatastore</CODE> bean is created after this configuration, so it is
+ destroyed first, leaving its sessions closed before the client itself is closed.</p>
+ </li>
+ </ul>
+
<a name="mongoDatastore()"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
diff --git a/docs/snapshot/grails-data/mongodb/api/org/grails/datastore/mapping/mongo/MongoDatastore.html b/docs/snapshot/grails-data/mongodb/api/org/grails/datastore/mapping/mongo/MongoDatastore.html
index 28254f49b6b..620230a4029 100644
--- a/docs/snapshot/grails-data/mongodb/api/org/grails/datastore/mapping/mongo/MongoDatastore.html
+++ b/docs/snapshot/grails-data/mongodb/api/org/grails/datastore/mapping/mongo/MongoDatastore.html
@@ -504,7 +504,7 @@ implements <a href='../../../../../MappingContextListener.html'>MappingContextLi
<tr class="altColor">
<td class="colFirst"><code></code></td>
<td class="colLast"><code>protected static org.grails.datastore.mapping.core.connections.ConnectionSources<com.mongodb.client.MongoClient, <a href='../../../../../org/grails/datastore/mapping/mongo/connections/MongoConnectionSourceSettings.html' title='MongoConnectionSourceSettings'>MongoConnectionSourceSettings</a>></code></td>
- <td class="colLast"><code><strong><a href="#createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext)">createDefaultConnectionSources</a></strong>(com.mongodb.client.MongoClient mongoClient, org.springframework.core.env.PropertyResolver configuration, <a href='../../../../../org/grails/datastore/mapping/mongo/config/MongoMappingContext.html'>Mongo [...]
+ <td class="colLast"><code><strong><a href="#createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext, boolean)">createDefaultConnectionSources</a></strong>(com.mongodb.client.MongoClient mongoClient, org.springframework.core.env.PropertyResolver configuration, <a href='../../../../../org/grails/datastore/mapping/mongo/config/MongoMappingContext.ht [...]
</tr>
<tr class="rowColor">
@@ -1329,12 +1329,15 @@ implements <a href='../../../../../MappingContextListener.html'>MappingContextLi
</li>
</ul>
- <a name="createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext)"><!-- --></a>
+ <a name="createDefaultConnectionSources(com.mongodb.client.MongoClient, org.springframework.core.env.PropertyResolver, org.grails.datastore.mapping.mongo.config.MongoMappingContext, boolean)"><!-- --></a>
<ul class="blockListLast">
<li class="blockList">
- <h4>protected static org.grails.datastore.mapping.core.connections.ConnectionSources<com.mongodb.client.MongoClient, <a href='../../../../../org/grails/datastore/mapping/mongo/connections/MongoConnectionSourceSettings.html' title='MongoConnectionSourceSettings'>MongoConnectionSourceSettings</a>> <strong>createDefaultConnectionSources</strong>(com.mongodb.client.MongoClient mongoClient, org.springframework.core.env.PropertyResolver configura [...]
- <p> Creates the connection sources for an existing com.mongodb.client.MongoClient
- <DL><DT><B>Parameters:</B></DT><DD><code>mongoClient</code> - The com.mongodb.client.MongoClient</DD><DD><code>configuration</code> - The configuration</DD><DD><code>mappingContext</code> - The <a href='../../../../../org/grails/datastore/mapping/mongo/config/MongoMappingContext.html' title='MongoMappingContext'>MongoMappingContext</a></DD></DL><DL><DT><B>Returns:</B></DT><DD>The org.grails.datastore.mapping.core.connections.ConnectionSources</DD></DL></p>
+ <h4>protected static org.grails.datastore.mapping.core.connections.ConnectionSources<com.mongodb.client.MongoClient, <a href='../../../../../org/grails/datastore/mapping/mongo/connections/MongoConnectionSourceSettings.html' title='MongoConnectionSourceSettings'>MongoConnectionSourceSettings</a>> <strong>createDefaultConnectionSources</strong>(com.mongodb.client.MongoClient mongoClient, org.springframework.core.env.PropertyResolver configura [...]
+ <p> Creates the connection sources for a com.mongodb.client.MongoClient.
+ <DL><DT><B>Parameters:</B></DT><DD><code>mongoClient</code> - The com.mongodb.client.MongoClient</DD><DD><code>configuration</code> - The configuration</DD><DD><code>mappingContext</code> - The <a href='../../../../../org/grails/datastore/mapping/mongo/config/MongoMappingContext.html' title='MongoMappingContext'>MongoMappingContext</a></DD><DD><code>closeable</code> - whether GORM owns the client and should close it on shutdown. Pass
+ <CODE>false</CODE> for an externally-supplied client (its lifecycle is owned by the
+ caller, e.g. a Spring-managed bean) and <CODE>true</CODE> for a client GORM created
+ itself, so it is not leaked.</DD></DL><DL><DT><B>Returns:</B></DT><DD>The org.grails.datastore.mapping.core.connections.ConnectionSources</DD></DL></p>
</li>
</ul>
diff --git a/docs/snapshot/grails-data/mongodb/api/org/grails/orm/hibernate/connections/HibernateConnectionSource.html b/docs/snapshot/grails-data/mongodb/api/org/grails/orm/hibernate/connections/HibernateConnectionSource.html
index 5a4c09f3791..948bfde747b 100644
--- a/docs/snapshot/grails-data/mongodb/api/org/grails/orm/hibernate/connections/HibernateConnectionSource.html
+++ b/docs/snapshot/grails-data/mongodb/api/org/grails/orm/hibernate/connections/HibernateConnectionSource.html
@@ -236,7 +236,7 @@ extends org.grails.datastore.mapping.core.connections.DefaultConnectionSource</p
<tr class="altColor">
<td class="colFirst"><code>class org.grails.datastore.mapping.core.connections.DefaultConnectionSource</code></td>
- <td class="colLast"><code>org.grails.datastore.mapping.core.connections.DefaultConnectionSource#close(), org.grails.datastore.mapping.core.connections.DefaultConnectionSource#equals(java.lang.Object), org.grails.datastore.mapping.core.connections.DefaultConnectionSource#getClass(), org.grails.datastore.mapping.core.connections.DefaultConnectionSource#getName(), org.grails.datastore.mapping.core.connections.DefaultConnectionSource#getSettings(), org.grails.data [...]
+ <td class="colLast"><code>org.grails.datastore.mapping.core.connections.DefaultConnectionSource#close(), org.grails.datastore.mapping.core.connections.DefaultConnectionSource#equals(java.lang.Object), org.grails.datastore.mapping.core.connections.DefaultConnectionSource#getClass(), org.grails.datastore.mapping.core.connections.DefaultConnectionSource#getName(), org.grails.datastore.mapping.core.connections.DefaultConnectionSource#getSettings(), org.grails.data [...]
</tr>
</table>
</ul>
diff --git a/docs/snapshot/grails-data/mongodb/manual/gettingStarted/outsideGrails.html b/docs/snapshot/grails-data/mongodb/manual/gettingStarted/outsideGrails.html
index 6f27b8a9459..6f792ab24a4 100644
--- a/docs/snapshot/grails-data/mongodb/manual/gettingStarted/outsideGrails.html
+++ b/docs/snapshot/grails-data/mongodb/manual/gettingStarted/outsideGrails.html
@@ -479,6 +479,29 @@ println Person.count()</code></pre>
</div>
</div>
<div class="paragraph">
+<p>You can also supply your own <code>com.mongodb.client.MongoClient</code> if you need to configure the driver directly:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code class="language-groovy" data-lang="groovy">MongoClient mongoClient = MongoClients.create("mongodb://localhost/mydb")
+def datastore = new MongoDatastore(mongoClient, Person)
+
+println Person.count()</code></pre>
+</div>
+</div>
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
+When you supply your own <code>MongoClient</code>, GORM does not close it when the datastore shuts down — the client is owned by whoever created it, so you are responsible for closing it. When GORM creates the client itself (for example <code>new MongoDatastore(Person)</code>), it closes it for you.
+</td>
+</tr>
+</table>
+</div>
+<div class="paragraph">
<p>For configuration you can either pass a map or an instance of the <code>org.springframework.core.env.PropertyResolver</code> interface:</p>
</div>
<div class="listingblock">
diff --git a/docs/snapshot/grails-data/mongodb/manual/index.html b/docs/snapshot/grails-data/mongodb/manual/index.html
index f43cf3bb6a5..202148ef1d5 100644
--- a/docs/snapshot/grails-data/mongodb/manual/index.html
+++ b/docs/snapshot/grails-data/mongodb/manual/index.html
@@ -951,6 +951,29 @@ abstract class BookService {
<p>Please note that with autowire by-type as the default, when multiple beans for same type are found the application with throw Exception. Use the Spring `@Qualifier annotation for <a href="https://docs.spring.io/spring-framework/docs/5.3.10/reference/html/core.html#beans-autowired-annotation-qualifiers">Fine-tuning Annotation Based Autowiring with Qualifiers</a>.</p>
</div>
</div>
+<div class="sect3">
+<h4 id="_mongoclient_lifecycle_for_an_externally_supplied_client">MongoClient Lifecycle for an Externally-Supplied Client</h4>
+<div class="paragraph">
+<p>When you construct a <code>MongoDatastore</code> with a <code>MongoClient</code> that you created yourself, GORM no longer closes that client when the datastore shuts down. The client is owned by whoever created it, so closing it is now your responsibility.</p>
+</div>
+<div class="paragraph">
+<p>This only affects you if you previously relied on <code>MongoDatastore.close()</code> to also close a client you passed in:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="groovy">MongoClient mongoClient = MongoClients.create(<span class="string"><span class="delimiter">"</span><span class="content">mongodb://localhost/mydb</span><span class="delimiter">"</span></span>)
+MongoDatastore datastore = <span class="keyword">new</span> MongoDatastore(mongoClient, Person)
+
+<span class="comment">// ...</span>
+
+datastore.close() <span class="comment">// no longer closes mongoClient</span>
+mongoClient.close() <span class="comment">// close the client you created</span></code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>No change is required when GORM creates the client itself — for example <code>new MongoDatastore(Person)</code>, or configuration-driven setups where GORM builds the client from <code>grails.mongodb.*</code> settings — because GORM continues to own and close those clients. A <code>MongoClient</code> registered as a Spring bean likewise continues to be closed by the <code>ApplicationContext</code>.</p>
+</div>
+</div>
</div>
</div>
</div>
@@ -1294,6 +1317,29 @@ println Person.count()</code></pre>
</div>
</div>
<div class="paragraph">
+<p>You can also supply your own <code>com.mongodb.client.MongoClient</code> if you need to configure the driver directly:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="groovy">MongoClient mongoClient = MongoClients.create(<span class="string"><span class="delimiter">"</span><span class="content">mongodb://localhost/mydb</span><span class="delimiter">"</span></span>)
+<span class="keyword">def</span> datastore = <span class="keyword">new</span> MongoDatastore(mongoClient, Person)
+
+println Person.count()</code></pre>
+</div>
+</div>
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
+When you supply your own <code>MongoClient</code>, GORM does not close it when the datastore shuts down — the client is owned by whoever created it, so you are responsible for closing it. When GORM creates the client itself (for example <code>new MongoDatastore(Person)</code>), it closes it for you.
+</td>
+</tr>
+</table>
+</div>
+<div class="paragraph">
<p>For configuration you can either pass a map or an instance of the <code>org.springframework.core.env.PropertyResolver</code> interface:</p>
</div>
<div class="listingblock">
diff --git a/docs/snapshot/grails-data/mongodb/manual/introduction/upgradeNotes.html b/docs/snapshot/grails-data/mongodb/manual/introduction/upgradeNotes.html
index 82d0b1b9588..80c24e5965a 100644
--- a/docs/snapshot/grails-data/mongodb/manual/introduction/upgradeNotes.html
+++ b/docs/snapshot/grails-data/mongodb/manual/introduction/upgradeNotes.html
@@ -489,6 +489,29 @@ abstract class BookService {
<p>Please note that with autowire by-type as the default, when multiple beans for same type are found the application with throw Exception. Use the Spring `@Qualifier annotation for <a href="https://docs.spring.io/spring-framework/docs/5.3.10/reference/html/core.html#beans-autowired-annotation-qualifiers">Fine-tuning Annotation Based Autowiring with Qualifiers</a>.</p>
</div>
</div>
+<div class="sect3">
+<h4 id="_mongoclient_lifecycle_for_an_externally_supplied_client">MongoClient Lifecycle for an Externally-Supplied Client</h4>
+<div class="paragraph">
+<p>When you construct a <code>MongoDatastore</code> with a <code>MongoClient</code> that you created yourself, GORM no longer closes that client when the datastore shuts down. The client is owned by whoever created it, so closing it is now your responsibility.</p>
+</div>
+<div class="paragraph">
+<p>This only affects you if you previously relied on <code>MongoDatastore.close()</code> to also close a client you passed in:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code class="language-groovy" data-lang="groovy">MongoClient mongoClient = MongoClients.create("mongodb://localhost/mydb")
+MongoDatastore datastore = new MongoDatastore(mongoClient, Person)
+
+// ...
+
+datastore.close() // no longer closes mongoClient
+mongoClient.close() // close the client you created</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>No change is required when GORM creates the client itself — for example <code>new MongoDatastore(Person)</code>, or configuration-driven setups where GORM builds the client from <code>grails.mongodb.*</code> settings — because GORM continues to own and close those clients. A <code>MongoClient</code> registered as a Spring bean likewise continues to be closed by the <code>ApplicationContext</code>.</p>
+</div>
+</div>
</div>
</div>
<div id="footer">