With CGLIB
I can do
final var enhancer = new Enhancer();
enhancer.setUseCache(false);
enhancer.setSuperclass(superClazz);
enhancer.setCallback(...);
enhancer.setClassLoader(getClass().getClassLoader()); // This
However with Javassist
I can't find a way to set the ClassLoader
. Any idea?
EDIT: omg, should I just subclass ProxyFactory
? That's weird.