Do not retain cache transaction managers

Previously, cache transaction managers may be  retained outside the
boundaries of an application context with AspectJ since an aspect is
basically a singleton for the current class loader.

This commit adds a "clearTransactionManagerCache" that is similar to the
"clearMetadataCache" introduced in CacheAspectSupport: whenever the
context is disposed, the cache is cleared to remove any reference to a
transaction manager defined by that context.

Issue: SPR-12518
This commit is contained in:
Stephane Nicoll
2014-12-16 16:26:02 +01:00
parent cec26e9ac4
commit fd7153ffbb
2 changed files with 14 additions and 1 deletions

View File

@@ -338,6 +338,13 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
}
}
/**
* Clear the cached transaction managers.
*/
protected void clearTransactionManagerCache() {
this.transactionManagerCache.clear();
}
/**
* Determine the specific transaction manager to use for the given transaction.
*/