動態代理擴充
擴充說明
將 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)