Log identity hash for ApplicationContext for context cache hits/misses

DefaultCacheAwareContextLoaderDelegate now logs the identity hash code
for an application context instance that was stored in or retrieved from
the context cache in the Spring TestContext Framework.

Closes gh-22925
This commit is contained in:
Sam Brannen 2019-05-08 16:39:23 +02:00
parent 4d1637a9b7
commit 6a05b97df3
1 changed files with 4 additions and 4 deletions

View File

@ -123,8 +123,8 @@ public class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContext
try {
context = loadContextInternal(mergedContextConfiguration);
if (logger.isDebugEnabled()) {
logger.debug(String.format("Storing ApplicationContext in cache under key [%s]",
mergedContextConfiguration));
logger.debug(String.format("Storing ApplicationContext [%s] in cache under key [%s]",
System.identityHashCode(context), mergedContextConfiguration));
}
this.contextCache.put(mergedContextConfiguration, context);
}
@ -134,8 +134,8 @@ public class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContext
}
else {
if (logger.isDebugEnabled()) {
logger.debug(String.format("Retrieved ApplicationContext from cache with key [%s]",
mergedContextConfiguration));
logger.debug(String.format("Retrieved ApplicationContext [%s] from cache with key [%s]",
System.identityHashCode(context), mergedContextConfiguration));
}
}