zoukankan      html  css  js  c++  java
  • dubbo

    provider

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
        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">
    <!-- 1,配置应用名称 -->
    <dubbo:application name="jt-dubbo-cart"/>
    <!-- 2,配置zookeeper的ip地址和端口号 -->
    <dubbo:registry timeout="9000000" address="zookeeper://192.168.132.140:2181"></dubbo:registry>
    <!-- 3,设置端口号,消费者通过网络访问这个提供者 -->
    <dubbo:protocol port="20886" name="dubbo"></dubbo:protocol>
    <!-- 4,配置实现类,创建对象 -->
    <bean class="com.jt.cart.service.CartServiceImpl" id="cartServiceImpl"></bean>
    <!-- 5, 公开对象,公开后,消费者只能通过网络访问-->
    <dubbo:service  interface="com.jt.cart.service.CartService" ref="cartServiceImpl">
    </dubbo:service>
    </beans>

    consumer

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
        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">
        <!-- 1, 配置应用名称 -->
        <dubbo:application name="jt-dubbo-cart" />
        <!-- 2, 配置zookeeper -->
        <dubbo:registry timeout="900000"
            address="zookeeper://192.168.132.140:2181"></dubbo:registry>
        <!-- 3,配置接口 -->
        <!-- spring LoginController 调LoginService,从spring框架有@service LoginServiceImpl 
            @autowired LoginService @autowired CartService 加了refrence标签,@autowired CartService 
            spring调dubbo框架,dubbo框架从zookeeper找到实现类 -->
        <dubbo:reference timeout="50000" check="false"
            id="cartServiceImpl" interface="com.jt.cart.service.CartService"></dubbo:reference>
    
        <dubbo:reference timeout="50000" check="false" id="orderService"
            interface="com.jt.order.service.OrderService"></dubbo:reference>
            
            
        <dubbo:reference timeout="50000" check="false" id="searchServiceervice"
            interface="com.jt.search.service.SearchService"></dubbo:reference>
            
            
    </beans>
  • 相关阅读:
    多线程爬取斗图啦图片
    fiddler配置https
    Linux相关命令实例及解析
    htm、html、shtml网页区别
    什么是中间件?常见中间件有哪些?
    列举常见的关系型数据库和非关系型都有那些?
    什么是dao模式,dao模式的实现方法
    如何理解fine-grained和coarse-grained?
    .Net 理解持久层(Persistence Layer)
    web server与app server有什么不同
  • 原文地址:https://www.cnblogs.com/gxlaqj/p/11758463.html
Copyright © 2011-2022 走看看