javaassist和cglib之间的区别 [英] difference between javaassist and cglib

查看:1255
本文介绍了javaassist和cglib之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道hibernate已经停止使用cglib并切换到javaassist。

我也理解javaassist和cglib用于代理生成。

所以我想知道这两种方法是如何工作的,哪一种更好?
他们的工作风格有何区别? 解决方案

Cglib不再积极维护,图书馆的开发人员不会甚至应用提供的补丁: https://jaxenter.com/ hibernate-to-deprecate-cglib-as-bytecode-provider-102106.html

另外,javassist提供了一个API来修改类,而不仅仅是子类化他们。这些API还允许字节代码级别的操作,而cglib只允许多个硬编码拦截。

最后,性能有一点差异。有关概述,请参阅我创建的第三个字节代码操作框架Byte Buddy上的此表: http:// bytebuddy .net /#/ tutorial


I learning hibernate and I understood that hibernate has stopped using cglib and switched to javaassist.

I also understood that javaassist and cglib are used for proxy generation.

so I was wondering how these two works and which one is better? What is the difference between their working style?

解决方案

Cglib is no longer actively maintained and the library's developers would not even apply provided patches: https://jaxenter.com/hibernate-to-deprecate-cglib-as-bytecode-provider-102106.html

Additionally, javassist offers an API for modifying classes and not only for subclassing them. These APIs allow also for byte code-level manipulation while cglib only allows for several hardcoded interceptions.

Finally, there is a minor performance difference. For an overview, see this table on a third byte code manipulation framework, Byte Buddy, that I created: http://bytebuddy.net/#/tutorial

这篇关于javaassist和cglib之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆