简体   繁体   English

javaassist和cglib之间的区别

[英]difference between javaassist and cglib

I learning hibernate and I understood that hibernate has stopped using cglib and switched to javaassist. 我学习了hibernate,我明白hibernate已经停止使用cglib并切换到javaassist。

I also understood that javaassist and cglib are used for proxy generation. 我也明白javaassist和cglib用于代理生成。

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 Cglib不再被主动维护,图书馆的开发人员甚至不会应用提供的补丁: 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. 此外,javassist提供了一个用于修改类的API,而不仅仅是为了对它们进行子类化。 These APIs allow also for byte code-level manipulation while cglib only allows for several hardcoded interceptions. 这些API还允许字节代码级操作,而cglib仅允许多个硬编码拦截。

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 有关概述,请参阅此表,其中包含我创建的第三个字节代码操作框架Byte Buddy: http//bytebuddy.net/#/tutorial

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM