Browse Source

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
pull/22929/head
Sam Brannen 6 years ago
parent
commit
6a05b97df3
  1. 8
      spring-test/src/main/java/org/springframework/test/context/cache/DefaultCacheAwareContextLoaderDelegate.java

8
spring-test/src/main/java/org/springframework/test/context/cache/DefaultCacheAwareContextLoaderDelegate.java vendored

@ -123,8 +123,8 @@ public class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContext @@ -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 @@ -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));
}
}

Loading…
Cancel
Save