Checking if ReflectionUtils class exists and clears its cache in the event of a class chanage

This commit is contained in:
davydotcom
2020-08-23 16:35:57 -04:00
parent cadaedcdee
commit cf07166f1d

View File

@@ -441,6 +441,16 @@ public class ReloadableType {
tagAsAffectedByReload();
tagSupertypesAsAffectedByReload();
tagSubtypesAsAffectedByReload();
//ReflectionUtils has a cache that needs cleared
try {
Class<?> reflecutionUtil = Class.forName("org.springframework.util.ReflectionUtils");
// java.lang.NoSuchMethodException: org.codehaus.groovy.reflection.ClassInfo$LazyCachedClassRef.clear()
Method clearMethod = reflecutionUtil.getMethod("clearCache");//DeclaredMethod("clear");
clearMethod.invoke(null);
} catch(Exception e3) {
//this better not blow up in my face
}
// ReflectionUtils.clearCache();
typeRegistry.fireReloadEvent(this, versionsuffix);