我知道 java.lang.ClassLoader 通常是我扩展的类加载器(在需要时)。另外,当我看到 tomcat、Jetty 等的自定义类加载器都是从 java.lang.ClassLoader 扩展而来的。
我很想了解 com.sun.org.apache.bcel.internal.util.ClassLoader 的目的和用法。
谁能帮我理解一下吗?
最佳答案
com.sun.org.apache.bcel.internal
只是 Apache BCEL 的重新打包。 。特别是,我们感兴趣的类 (ClassLoader
) 记录在 here 中。 ...
Drop in replacement for the standard class loader of the JVM. You can use it in conjunction with the
JavaWrapper
to dynamically modify/create classes as they're requested.This class loader recognizes special requests in a distinct format, i.e., when the name of the requested class contains with "$$BCEL$$" it calls the
createClass()
method with that name (everything before the $$BCEL$$ is considered to be the package name. You can subclass the class loader and override that method. "Normal" classes class can be modified by overriding themodifyClass()
method which is called just beforedefineClass()
.
关于java - Java 中的类加载器变体和用法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12337283/