提供方xml:
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<!-- dubbo 配置 -->
<!-- 提供方应用信息,用于计算依赖关系 -->
<dubbo:application name="projectname" logger="slf4j" owner="ownername"
organization="organization"/>
<!-- 注册中心 client="curator"-->
<dubbo:registry protocol="zookeeper" address="${dubbo.registry.address}(可多填)"
id="registryID"/>
<!-- 用dubbo协议在12345端口暴露服务 -->
<dubbo:protocol name="dubboname" port="port(如12345)" id="dubbo"/>
<!-- 为服务提供者设置默认配置 -->
<dubbo:provider id="es_pro_conf" threads="15" delay="-1" timeout="10000" retries="0"
connections="1" token="true" registry="registryID" executes="40" actives="10"
protocol="dubbo"/>
<!--====================== provider =========================-->
<dubbo:provider id="providerID" threads="50" delay="-1" timeout="10000" retries="1"
connections="1" token="true" registry="registry" executes="20" actives="10"
protocol="dubbo"/>
<dubbo:service interface="interface.class" ref="whatever"
provider = "providerID"/>
</beans>
消费方xml:
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<!--====================== dubbo commons =========================-->
<!-- 消费方应用名,用于计算依赖关系,不是匹配条件,不要与提供方一样 -->
<dubbo:application name="shareprofit_common_dubbo" owner="ownername" organization="organization"/>
<!-- 使用zookeeper注册中心暴露发现服务地址 -->
<dubbo:registry protocol="zookeeper" address="${dubbo.registry.address}" id="registryID"/>
<!-- 用dubbo协议在12345端口暴露服务 -->
<dubbo:protocol name="dubbo" port="12345" id="dubbo"/>
<!--====================== consumer =========================-->
<dubbo:consumer id="consumerID" timeout="10000" retries="1" check="false" registry="registry"/>
<!--调用银联前置蓝海计划上传图片接口-->
<dubbo:reference id="ID" version="1.0.0" interface="interface.class"
consumer="consumerID" owner="ownername"/>
</beans>