zhoutianli518 commented on issue #2051:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/2051#issuecomment-731976379


   明白你的意思了。通过@bean注解,业务直接构造要调用的接口的动态代理,而动态代理的实现就是业务自定义的MyInvoker(继承原Invoker 
,覆写invoker方法)。 
   
   如果不想用@bean注解,用xml配置bean,可以类似这么用
   
   定义一个FactoryBean实现
   public class CseReferenceBean implements FactoryBean<Object> {
   
       protected Class<?> intf;
   
       public void setIntf(Class<?> intf) {
         this.intf = intf;
       }
   
       @Override
       public Class<?> getObjectType() {
           return intf;
       }
       
       @Override
       public Object getObject() throws Exception {
            return MyInvoker.createProxy(......); //返回自定义的代理实现
       }
   }
   
   xml bean如此定义即可。
   
        <bean class="com.xxx.CseReferenceBean">
                <property name="intf" value="com.xxx.MyConsumerInterface"/>
        </bean>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to