• Usage(用法)


    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

    Spring远程服务配置

    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 into remote-privider.xml(exists in the provider node), meanwhile the refrence part into remote-consumer.xml(exists in the consumer node).
    • 把local.xml切割成两部分,把定义服务的部分放在remote-provider.xml中(存在于提供端),与此同时引用部分放在remote-consumer.xml(存在于消费端节点)
    • add <dubbo:service> to the provider's configuration, and <dubbo:reference> to the consumer's configuration.
    • 添加<dubbo:service>到提供端配置,并且添加<dubbo:reference>到消费端配置。

    remote-provider.xml:

    远程提供者xml

    <!-- define remote service bean the same way as local service bean -->
        像本地服务bean一样定义远程服务bean <bean id=“xxxService” class=“com.xxx.XxxServiceImpl” /> <!-- expose the remote service -->
    暴露远程服务 <dubbo:service interface=“com.xxx.XxxService” ref=“xxxService” />

    remote-consumer.xml:

    远程消费端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>
  • 相关阅读:
    剑指offer——其三
    剑指offer——其二
    剑指offer——其一
    数的读法 蓝桥杯练习题 Java
    2017小结及遇见更好的2018
    自然语言处理随笔(一)
    Shell实现Windows回收站功能
    解决win7下vc6.0打开添加文件错误 崩溃
    Could not load file or assembly Microsoft.Data.OData Version=5.2.0.0 error in Azure Cloud Worker Role using Table Storage
    String两种实例化方法的区别
  • 原文地址:https://www.cnblogs.com/zhijicompanyethan/p/13928234.html
Copyright © 2020-2023  润新知