local.xml:
<bean id=“xxxService” class=“com.xxx.XxxServiceImpl” /> <bean id=“xxxAction” class=“com.xxx.XxxAction”> <property name=“xxxService” ref=“xxxService” /> </bean>
The remote configuration can be done by very little change based on the local configuration:
local.xml
into two part, put the service define part into remote-privider.xml
(exists in the provider node), meanwhile the refrence part into remote-consumer.xml
(exists in the consumer node).<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>