File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
spring-beans/src/main/java/org/springframework/beans Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2022 the original author or authors.
2
+ * Copyright 2002-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -248,9 +248,22 @@ private static BeanInfo getBeanInfo(Class<?> beanClass) throws IntrospectionExce
248
248
return beanInfo ;
249
249
}
250
250
}
251
- return (shouldIntrospectorIgnoreBeaninfoClasses ?
251
+
252
+ BeanInfo beanInfo = (shouldIntrospectorIgnoreBeaninfoClasses ?
252
253
Introspector .getBeanInfo (beanClass , Introspector .IGNORE_ALL_BEANINFO ) :
253
254
Introspector .getBeanInfo (beanClass ));
255
+
256
+ // Immediately remove class from Introspector cache to allow for proper garbage
257
+ // collection on class loader shutdown; we cache it in CachedIntrospectionResults
258
+ // in a GC-friendly manner. This is necessary (again) for the JDK ClassInfo cache.
259
+ Class <?> classToFlush = beanClass ;
260
+ do {
261
+ Introspector .flushFromCaches (classToFlush );
262
+ classToFlush = classToFlush .getSuperclass ();
263
+ }
264
+ while (classToFlush != null && classToFlush != Object .class );
265
+
266
+ return beanInfo ;
254
267
}
255
268
256
269
You can’t perform that action at this time.
0 commit comments