Ensure context cache stats are logged when ApplicationContext fails to load

Closes gh-30635
This commit is contained in:
Sam Brannen 2023-06-11 15:46:28 +02:00
parent 439bcd6715
commit 1a26e17f41
1 changed files with 37 additions and 34 deletions

View File

@ -109,6 +109,7 @@ public class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContext
mergedContextConfiguration = replaceIfNecessary(mergedContextConfiguration);
synchronized (this.contextCache) {
ApplicationContext context = this.contextCache.get(mergedContextConfiguration);
try {
if (context == null) {
try {
if (mergedContextConfiguration instanceof AotMergedContextConfiguration aotMergedConfig) {
@ -149,8 +150,10 @@ public class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContext
System.identityHashCode(context), mergedContextConfiguration));
}
}
}
finally {
this.contextCache.logStatistics();
}
return context;
}