Dubbo 3.x源碼分析系列 - 基礎(chǔ)篇

本篇章主要是描述工程的原始信息,后面的大多數(shù)文章里都會(huì)進(jìn)行引用,作為一個(gè)公共部分把。

源碼地址https://github.com/woaijiadanoo/dubbo_3.git

核心框架版本:
1、Dubbo版本: 3.0.1
2、Springboot版本: 2.5.0
3、zookeeper版本:3.7.0

Dubbo基本配置

    <!-- 提供方應(yīng)用信息,用于計(jì)算依賴關(guān)系,name可以隨便起名,但是不能重復(fù) -->
    <dubbo:application name="hello-world-producer"/>

    <!-- 使用zookeeper為注冊(cè)中心,客戶端使用curator -->
    <dubbo:registry address="zookeeper://localhost:2181" client="curator"/>

    <!-- 對(duì)外提供一個(gè)providerService的服務(wù),服務(wù)對(duì)應(yīng)的實(shí)現(xiàn) ref="providerService" -->
    <dubbo:service id="producerService"
                   interface="com.jiangzh.course.dubbo.service.HelloServiceAPI"
                   ref="iProducerService"/>

    <bean id="iProducerService" class="com.jiangzh.course.dubbo.producer.impl.HelloServiceImpl"/>

對(duì)外提供的服務(wù)

package com.jiangzh.course.dubbo.service;

public interface HelloServiceAPI {

    /*
        傳入一個(gè)Message,增加Hello的回復(fù)
     */
    String sayHello(String message);

}

服務(wù)的具體實(shí)現(xiàn)

package com.jiangzh.course.dubbo.producer.impl;

import com.jiangzh.course.dubbo.service.HelloServiceAPI;

public class HelloServiceImpl implements HelloServiceAPI {
    @Override
    public String sayHello(String message) {
        return "Producer response : Hello " +message;
    }
}

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容