哪一个使用cglib或javaassist [英] Which one to use cglib or javaassist

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

问题描述

cglib和javaassist之间的区别是什么


  1. cglib是否创建代理运行时?
  2. javaassist如何创建代理?

  3. 什么是字节码检测?

  4. hibernate如何使用这些库?

  5. < Byte Buddy是一个代码生成库,用于在Java应用程序运行时创建Java类,而不需要编译器的帮助。除代码生成实用程序之外,它允许创建任意类,并且不限于为创建运行时代理实现接口。

    Byte Buddy是cglib和javaassist的不错替代品。看看在Byte Buddy,cglib,javaassist和jdkproxy之间对各种替代方案进行基准测试。

    查看 SE问题相同。



    关于您的查询: b
    $ b

    字节码检测:(来自 cs.helsinki

    < blockquote>

    字节码检测是一个过程,通过在虚拟机加载之前修改一组类的字节码,将新功能添加到程序中:


    cglib和javassist都是早期创建的,它们的API是围绕Java现在提供的语言功能构建的。



    注释是在这些图书馆推出之后引入的重大创新。
    $ b Byte Buddy使用注释和特定领域的语言来实现其目标。

    what is the difference between working of cglib and javaassist

    1. Does cglib creates proxies runtime?
    2. How does javaassist creates proxies?
    3. What is bytecode instrumentation?
    4. How hibernate uses these libraries?

    解决方案

    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.

    这篇关于哪一个使用cglib或javaassist的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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