Convert the Invoker
interface into a business interface.
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 project structure:
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