Which one to use cglib or javaassist

我的梦境 提交于 2019-12-06 13:57:27

The best bytecode manipulation library is ASM (http://asm.ow2.org/). It's really fast and simple to understand.

Ravindra babu

Byte Buddy is a code generation library for creating Java classes during the runtime of a Java application and without the help of a compiler. Other than the code generation utilities, it allows the creation of arbitrary classes and is not limited to implementing interfaces for the creation of runtime proxies.

Byte Buddy is good alternative to both cglib and javaassist. Have a look at Benchmarking various alternatives among Byte Buddy, cglib, javaassist and jdkproxy.

Have a look at SE question regarding the same.

Regarding your queries:

Bytecode instrumentation: ( from cs.helsinki)

Bytecode instrumentation is a process where new function- ality is added to a program by modifying the bytecode of a set of classes before they are loaded by the virtual machine :

Both cglib and javassist were created early and their APIs were built around the language features that Java had to offer back in these days.

Annotation is significant innovations introduced after the inception of these libraries.

Byte Buddy uses annotations and a domain specific language for achieving its ambitions.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!