2008-03-17
定制类加载器有什么特殊的好处?
定制类加载器有什么特殊的好处?
刚才看eddiegift的博客(http://eddiegift.javaeye.com/blog/172271),他写一个类加载器.以前一直没弄过这方面的代码,也不知道这样的类加载器有什么特殊的好处,那如何在实际中让JVM用自写的类加载器而不用JVM提供的类加载器呢?
写这里想起来了些这方面的应用,前些天看Spring In Action里的AOP时,有下面一段:
The weaving can take place at several points in the target object’s lifetime:
■ Compile time—Aspects are woven in when the target class is compiled. This
requires a special compiler. AspectJ’s weaving compiler weaves aspects this
way.
■ Classload time—Aspects are woven in when the target class is loaded into the
JVM. This requires a special ClassLoader that enhances that target class’s
bytecode before the class is introduced into the application. AspectJ 5’s
load-time weaving (LTW) support weaves aspects in this way.
■ Runtime—Aspects are woven in sometime during the execution of the appli-
cation. Typically, an AOP container will dynamically generate a proxy object
that will delegate to the target object while weaving in the aspects. This is
how Spring AOP aspects are woven.
也就是说可以用自写的类加载器来实现AOP的Weaving,那还有没有别的应用呢?怎么配置来让JVM调用定制的类加载器呢?
刚才看eddiegift的博客(http://eddiegift.javaeye.com/blog/172271),他写一个类加载器.以前一直没弄过这方面的代码,也不知道这样的类加载器有什么特殊的好处,那如何在实际中让JVM用自写的类加载器而不用JVM提供的类加载器呢?
写这里想起来了些这方面的应用,前些天看Spring In Action里的AOP时,有下面一段:
The weaving can take place at several points in the target object’s lifetime:
■ Compile time—Aspects are woven in when the target class is compiled. This
requires a special compiler. AspectJ’s weaving compiler weaves aspects this
way.
■ Classload time—Aspects are woven in when the target class is loaded into the
JVM. This requires a special ClassLoader that enhances that target class’s
bytecode before the class is introduced into the application. AspectJ 5’s
load-time weaving (LTW) support weaves aspects in this way.
■ Runtime—Aspects are woven in sometime during the execution of the appli-
cation. Typically, an AOP container will dynamically generate a proxy object
that will delegate to the target object while weaving in the aspects. This is
how Spring AOP aspects are woven.
也就是说可以用自写的类加载器来实现AOP的Weaving,那还有没有别的应用呢?怎么配置来让JVM调用定制的类加载器呢?
- 11:52
- 浏览 (317)
- 评论 (0)
- 分类: Coder碎语
- 发布在 discovery & surprise 圈子
- 相关推荐
发表评论
- 浏览: 29394 次
- 性别:

- 来自: 北京

- 详细资料
搜索本博客
链接
最新评论
-
对浏览器中的context menu ...
Drag dropper
-- by whqida -
Spring中的load-time weav ...
没啥,有些class不在spring的管理之中,通过 load-time wea ...
-- by ray_linn -
对浏览器中的context menu ...
别搞笑了, 这是浏览器的 Context Menu? 这只不过是响应了鼠标右击事 ...
-- by fcoffee -
IE tab在Firefox里开发时 ...
firebug只能用于ff, 并不能用于ff下的ietab, 原因显而易见.如果 ...
-- by fcoffee -
IE tab在Firefox里开发时 ...
还网告知 该如何操作呢 我还是要到ie下再调试啊
-- by jianfeng008cn






评论排行榜