Skip to content

Commit 6a05b97

Browse files
committed
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
1 parent 4d1637a commit 6a05b97

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ public ApplicationContext loadContext(MergedContextConfiguration mergedContextCo
123123
try {
124124
context = loadContextInternal(mergedContextConfiguration);
125125
if (logger.isDebugEnabled()) {
126-
logger.debug(String.format("Storing ApplicationContext in cache under key [%s]",
127-
mergedContextConfiguration));
126+
logger.debug(String.format("Storing ApplicationContext [%s] in cache under key [%s]",
127+
System.identityHashCode(context), mergedContextConfiguration));
128128
}
129129
this.contextCache.put(mergedContextConfiguration, context);
130130
}
@@ -134,8 +134,8 @@ public ApplicationContext loadContext(MergedContextConfiguration mergedContextCo
134134
}
135135
else {
136136
if (logger.isDebugEnabled()) {
137-
logger.debug(String.format("Retrieved ApplicationContext from cache with key [%s]",
138-
mergedContextConfiguration));
137+
logger.debug(String.format("Retrieved ApplicationContext [%s] from cache with key [%s]",
138+
System.identityHashCode(context), mergedContextConfiguration));
139139
}
140140
}
141141

0 commit comments

Comments
 (0)