编译器扩展

扩展说明

Java 代码编译器,用于动态生成字节码以加速调用。

扩展端口

org.apache.dubbo.common.compiler.Compiler

扩展配置

自动加载

已知扩展

  • org.apache.dubbo.common.compiler.support.JdkCompiler
  • org.apache.dubbo.common.compiler.support.JavassistCompiler

扩展示例

Maven 项目结构

src
 |-main
    |-java
        |-com
            |-xxx
                |-XxxCompiler.java (implement Compiler interface)
    |-resources
        |-META-INF
            |-dubbo
                |-org.apache.dubbo.common.compiler.Compiler (plain text file, content: xxx=com.xxx.XxxCompiler)

XxxCompiler.java

package com.xxx;
 
import org.apache.dubbo.common.compiler.Compiler;
 
public class XxxCompiler implements Compiler {
    public Object getExtension(Class<?> type, String name) {
        //...
    }
}

META-INF/dubbo/org.apache.dubbo.common.compiler.Compiler

xxx=com.xxx.XxxCompiler

上次修改时间:2023 年 1 月 2 日:增强英文文档 (#1798) (95a9f4f6c1c)