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 (实现Compiler接口)
|-resources
|-META-INF
|-dubbo
|-org.apache.dubbo.common.compiler.Compiler (纯文本文件,内容为: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