dubbo 接口有多個實現時的配置方案

服務提供方(註解方式):java

  1. xml配置:
<dubbo:annotation package="cn.com.xxx.business" />
  1. java註解
@Service(group="refund",version="0.1.0")
public class RefundBusinessImpl extends RefundBusinessAbstract<RefundDO> implements RefundBusiness
@Service(group="refundGoods",version="0.1.0")
public class RefundGoodsBusinessImpl extends RefundBusinessAbstract<RefundGoodsDO> implements RefundBusiness
@Service(group="refundNotReturnGoods",version="0.1.0")
public class RefundNotReturnGoodsBusinessImpl extends RefundGoodsBusinessImpl implements RefundBusiness

服務消費方spring

<dubbo:reference interface="cn.com.xxx.business.RefundBusiness" group="refund" id="refundBusiness" version="0.1.0"/>
  <dubbo:reference interface="cn.com.xxx.business.RefundBusiness" group="refundGoods" id="refundGoodsBusiness" version="0.1.0"/>
  <dubbo:reference interface="cn.com.xxx.business.RefundBusiness" group="refundNotReturnGoods" id="refundNotReturnGoodsBusiness" version="0.1.0"/>這裏輸入代碼

後記:若是不使用dubbo,這樣的多種實現方式是沒有問題,bean id匹配無誤,按道理dubbo應該能夠經過spring來獲取匹配關係,不知爲什麼要單獨配置code

相關文章
相關標籤/搜索