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>
  • 相关阅读:
    程序员副业那些事:聊聊出书和录视频
    跳槽时,不敢要高工资也会对候选人不利
    SQL 查询今天、昨天、7天内、30天的数据
    jquery table按列名称排序
    Asp.Net微信js分享
    表格插件BootStrap-Table使用教程
    ASP.NET中IOC容器Autofac(依赖注入DI 控制反转IOC)
    IIS添加MIME类型.woff/.svg/.woff2/.eot/.otf.ttf
    div垂直居中水平居中css
    Asp.Net报https请求报传输流收到意外的 EOF 或 0 个字节
  • 原文地址:https://www.cnblogs.com/gxlaqj/p/11758463.html
Copyright © 2011-2022 走看看