Reset common caches before LifecycleProcessor-initiated checkpoint

See gh-29921
This commit is contained in:
Juergen Hoeller 2023-06-02 20:42:37 +02:00
parent 8c6287ef7b
commit 25a1e8d414
1 changed files with 7 additions and 5 deletions

View File

@ -463,7 +463,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
@Override @Override
public void setApplicationStartup(ApplicationStartup applicationStartup) { public void setApplicationStartup(ApplicationStartup applicationStartup) {
Assert.notNull(applicationStartup, "applicationStartup must not be null"); Assert.notNull(applicationStartup, "ApplicationStartup must not be null");
this.applicationStartup = applicationStartup; this.applicationStartup = applicationStartup;
} }
@ -628,9 +628,6 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
} }
finally { finally {
// Reset common introspection caches in Spring's core, since we
// might not ever need metadata for singleton beans anymore...
resetCommonCaches();
contextRefresh.end(); contextRefresh.end();
} }
} }
@ -946,8 +943,10 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
* onRefresh() method and publishing the * onRefresh() method and publishing the
* {@link org.springframework.context.event.ContextRefreshedEvent}. * {@link org.springframework.context.event.ContextRefreshedEvent}.
*/ */
@SuppressWarnings("deprecation")
protected void finishRefresh() { protected void finishRefresh() {
// Reset common introspection caches in Spring's core infrastructure.
resetCommonCaches();
// Clear context-level resource caches (such as ASM metadata from scanning). // Clear context-level resource caches (such as ASM metadata from scanning).
clearResourceCaches(); clearResourceCaches();
@ -968,6 +967,9 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
*/ */
protected void cancelRefresh(BeansException ex) { protected void cancelRefresh(BeansException ex) {
this.active.set(false); this.active.set(false);
// Reset common introspection caches in Spring's core infrastructure.
resetCommonCaches();
} }
/** /**