• dubbo本地调试直连


    服务:

    <?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:context="http://www.springframework.org/schema/context"
           xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
             http://www.springframework.org/schema/beans/spring-beans.xsd
             http://www.springframework.org/schema/context
             http://www.springframework.org/schema/context/spring-context.xsd
             http://code.alibabatech.com/schema/dubbo
             http://code.alibabatech.com/schema/dubbo/dubbo.xsd" default-autowire="byName">
    
        <dubbo:provider group="xxx"/>

    <!-- 提供方应用信息,用于计算依赖关系 -->
    <dubbo:application name="sports-basic-provider"/>

    <!-- 使用zookeeper注册中心暴露服务地址 -->
    <dubbo:registry protocol="zookeeper" address="${dubbo.registry.address}"/>

    <!-- 使用dubbo协议在20880端口暴露服务 -->
    <dubbo:protocol name="dubbo" port="20880"/>

        <!-- basic start -->
        <dubbo:service interface="com.xxx.basic.manage.service.OrganizationService" ref="organizationService" timeout="10000"/>
        <dubbo:service interface="com.xxx.basic.manage.service.ResourceService" ref="resourceService" timeout="10000"/>
        <dubbo:service interface="com.xxx.basic.manage.service.SysRoleService" ref="sysRoleService" timeout="10000"/>
        <dubbo:service interface="com.xxx.basic.manage.service.SysUserService" ref="sysUserService" timeout="10000"/>
    
    </beans>

    增加三行黑色的

    消费端:

    consumer.xml:

    <?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.xsd
                http://code.alibabatech.com/schema/dubbo
                http://code.alibabatech.com/schema/dubbo/dubbo.xsd" default-autowire="byName">
    
        <dubbo:application name="${dubbo.application.name}"/>
        <dubbo:registry address="${dubbo.registry.address}" timeout="${dubbo.consumer.timeout}" />
        <dubbo:consumer retries="${dubbo.consumer.retries}" group="oa" />
    
        <!-- basic start -->
        <dubbo:reference  interface="com.xxx.basic.manage.service.SysRoleService" id="sysRoleService" check="false" url="dubbo://localhost:20880"/>
        <dubbo:reference  interface="com.xxx.basic.manage.service.ResourceService" id="resourceService" check="false" url="dubbo://localhost:20880" />
        <dubbo:reference  interface="com.xxx.basic.manage.service.OrganizationService" id="organizationService" check="false" url="dubbo://localhost:20880" />
        <dubbo:reference  interface="com.xxx.basic.manage.service.SysUserService" id="sysUserService" check="false" url="dubbo://localhost:20880"/>
       
    
    </beans>

    增加url="dubbo://localhost:20880"即可。

  • 相关阅读:
    Eclipse 插件Maven在使用 add dependency,找不到包,解决办法
    SimpleDateFormat是线程不安全的,切忌切忌!
    JNative 传递参数bug
    oracle存储过程递归调用
    oracle调用DLL
    telnet和Netstat使用
    notepad++搭配dev配置运行C++
    ubuntu第一次安装登陆密码不正确问题
    区分形参和实参
    爬虫2
  • 原文地址:https://www.cnblogs.com/gmq-sh/p/7147798.html
Copyright © 2020-2023  润新知