Compiler Extensions

Expansion Description

Java code compiler, used to dynamically generate bytecode to speed up calls.

Extension ports

org.apache.dubbo.common.compiler.Compiler

Extended configuration

autoload

Known extensions

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

Extended example

Maven project structure:

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

Last modified January 2, 2023: Enhance en docs (#1798) (95a9f4f6c1c)