Ensure context cache stats are logged when ApplicationContext fails to load
Closes gh-30635
This commit is contained in:
parent
439bcd6715
commit
1a26e17f41
|
@ -109,6 +109,7 @@ public class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContext
|
||||||
mergedContextConfiguration = replaceIfNecessary(mergedContextConfiguration);
|
mergedContextConfiguration = replaceIfNecessary(mergedContextConfiguration);
|
||||||
synchronized (this.contextCache) {
|
synchronized (this.contextCache) {
|
||||||
ApplicationContext context = this.contextCache.get(mergedContextConfiguration);
|
ApplicationContext context = this.contextCache.get(mergedContextConfiguration);
|
||||||
|
try {
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
try {
|
try {
|
||||||
if (mergedContextConfiguration instanceof AotMergedContextConfiguration aotMergedConfig) {
|
if (mergedContextConfiguration instanceof AotMergedContextConfiguration aotMergedConfig) {
|
||||||
|
@ -149,8 +150,10 @@ public class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContext
|
||||||
System.identityHashCode(context), mergedContextConfiguration));
|
System.identityHashCode(context), mergedContextConfiguration));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
finally {
|
||||||
this.contextCache.logStatistics();
|
this.contextCache.logStatistics();
|
||||||
|
}
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue