动态代理扩展
扩展说明
将 Invoker
接口转换为业务接口。
扩展点
org.apache.dubbo.rpc.ProxyFactory
扩展配置
<dubbo:protocol proxy="xxx" />
<!-- Default value configuration, when <dubbo:protocol> does not configure proxy attribute, use this configuration -->
<dubbo:provider proxy="xxx" />
已知扩展
org.apache.dubbo.rpc.proxy.JdkProxyFactory
org.apache.dubbo.rpc.proxy.JavassistProxyFactory
扩展示例
Maven 项目结构
src
|-main
|-java
|-com
|-xxx
|-XxxProxyFactory.java (implement ProxyFactory interface)
|-resources
|-META-INF
|-dubbo
|-org.apache.dubbo.rpc.ProxyFactory (plain text file, content: xxx=com.xxx.XxxProxyFactory)
XxxProxyFactory.java
package com.xxx;
import org.apache.dubbo.rpc.ProxyFactory;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.RpcException;
public class XxxProxyFactory implements ProxyFactory {
public <T> T getProxy(Invoker<T> invoker) throws RpcException {
//...
}
public <T> Invoker<T> getInvoker(T proxy, Class<T> type, URL url) throws RpcException {
//...
}
}
META-INF/dubbo/org.apache.dubbo.rpc.ProxyFactory
xxx=com.xxx.XxxProxyFactory
上次修改时间:2023 年 1 月 2 日: 增强英文文档 (#1798) (95a9f4f6c1c)