java-assist

Java Adding field and method to compiled class and reload using class loader

牧云@^-^@ 提交于 2020-06-11 11:43:57
问题 I would like to add field along with its getter/setter in compiled Java classes which is loaded in a Spring boot application. I was able to modify the class using JavaAssist and ASM. But the problem is it is not letting me reload the class after modification, since this is already been loaded. I tried to write a class extending java.lang.ClassLoader but custom classloader is not getting called. Also, I checked java's Instrumentation API which clearly states The retransformation may change

Java Adding field and method to compiled class and reload using class loader

那年仲夏 提交于 2020-06-11 11:43:09
问题 I would like to add field along with its getter/setter in compiled Java classes which is loaded in a Spring boot application. I was able to modify the class using JavaAssist and ASM. But the problem is it is not letting me reload the class after modification, since this is already been loaded. I tried to write a class extending java.lang.ClassLoader but custom classloader is not getting called. Also, I checked java's Instrumentation API which clearly states The retransformation may change