Usage
(#)
Local Service: (Spring configuration)
Local.xml
< bean id=“xxxService” class=“com.xxx.XxxServiceImpl” /> < bean id=“xxxAction” class=“com.xxx.XxxAction”> < property name=“xxxService” ref=“xxxService” /> </ bean > |
Remote service: (Spring configuration)
On the basis of local services, you can complete the remoting by simply configuring:
- Split the above local.xml configuration into two parts, place the service definition part on the service provider Remote-provider.xml, and place the service reference part in the service consumer Remote-consumer.xml.
- and increase the exposure service configuration <dubbo:service> in the provider, add the Referral service configuration <dubbo:reference> in the consumer.
As follows:
Remote-provider.xml
< bean id=“xxxService” class=“com.xxx.XxxServiceImpl” /> <!-- 和本地服务一样实现远程服务 --> < dubbo:service interface=“com.xxx.XxxService” ref=“xxxService” /> <!-- 增加暴露远程服务配置 --> |
Remote-consumer.xml
< dubbo:reference id=“xxxService” interface=“com.xxx.XxxService” /> <!-- 增加引用远程服务配置 --> < bean id=“xxxAction” class=“com.xxx.XxxAction”> <!-- 和本地服务一样使用远程服务 --> < property name=“xxxService” ref=“xxxService” /> |
The 2-dubbo usage of the first Knowledge Dubbo series