Convert Invoker
into business interface.
com.alibaba.dubbo.rpc.ProxyFactory
<dubbo:protocol proxy="xxx" /> <!-- default configuration, it will take effect when proxy attribute is not configured in <dubbo:protocol> --> <dubbo:provider proxy="xxx" />
com.alibaba.dubbo.rpc.proxy.JdkProxyFactory
com.alibaba.dubbo.rpc.proxy.JavassistProxyFactory
Directory layout:
src |-main |-java |-com |-xxx |-XxxProxyFactory.java (ProxyFactory implementation) |-resources |-META-INF |-dubbo |-com.alibaba.dubbo.rpc.ProxyFactory (plain text file with the content: xxx=com.xxx.XxxProxyFactory)
XxxProxyFactory.java:
package com.xxx; import com.alibaba.dubbo.rpc.ProxyFactory; import com.alibaba.dubbo.rpc.Invoker; import com.alibaba.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/com.alibaba.dubbo.rpc.ProxyFactory:
xxx=com.xxx.XxxProxyFactory