Usage
First glance at dubbo
Spring configuration of local service
local.xml:
<bean id=“xxxService” class=“com.xxx.XxxServiceImpl” />
<bean id=“xxxAction” class=“com.xxx.XxxAction”>
<property name=“xxxService” ref=“xxxService” />
</bean>
Spring configuration of remote service
The remote configuration can be done by very little change based on the local configuration:
- split the
local.xml
into two part, put the service define part intoremote-privider.xml
(exists in the provider node), meanwhile the refrence part intoremote-consumer.xml
(exists in the consumer node). - add
<dubbo:service>
to the provider’s configuration, and<dubbo:reference>
to the consumer’s configuration.
remote-provider.xml:
<!-- define remote service bean the same way as local service bean -->
<bean id=“xxxService” class=“com.xxx.XxxServiceImpl” />
<!-- expose the remote service -->
<dubbo:service interface=“com.xxx.XxxService” ref=“xxxService” />
remote-consumer.xml:
<!-- reference the remote service -->
<dubbo:reference id=“xxxService” interface=“com.xxx.XxxService” />
<!-- use remote service the same say as local service -->
<bean id=“xxxAction” class=“com.xxx.XxxAction”>
<property name=“xxxService” ref=“xxxService” />
</bean>
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.
Last modified December 22, 2020: clean up website (6e41905afa)