gpt4 book ai didi

java - Java 中的类加载器变体和用法

转载 作者:行者123 更新时间:2023-12-02 07:35:18 25 4
gpt4 key购买 nike

我知道 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 the modifyClass() method which is called just before defineClass().

关于java - Java 中的类加载器变体和用法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12337283/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com