dubbo 服務暴露 路徑問題

2021-09-08 12:09:04 字數 1482 閱讀 9835

配置dubbo的時候看到了乙個非常奇怪的配置:

問題1:埠是否重複?

問題2:jaxrs不在文件中,協議效果是什麼?

spring在容器載入完畢後使用監聽者模式推送event

// package com.alibaba.dubbo.config.spring;

// 在解析dubbo-spring.xml的時候已經載入到了spring容器

beannameaware

if (contextrefreshedevent.class.getname().equals(event.getclass().getname()) && this.isdelay() && !this.i***ported() && !this.isunexported())

this.export(); //呼叫父類的方法,是父類

}}

然後進入:serviceconfig

// package com.alibaba.dubbo.config;

public class serviceconfigextends abstractserviceconfig

protected synchronized void doexport()

private void doexporturls() }}

下面是乙個非常長的方法:

private void doexporturlsfor1protocol(protocolconfig protocolconfig, listregistryurls)

// 省略獲取ref 遠端服務源

port = null;

integer port;

if (!"webservice".equals(protocolconfig.getname()) && !"jaxrs".equals(protocolconfig.getname())) else

}if (null == port)

}//無關**

exporter<?> exporter = protocol.export(invoker); // exporter代表乙個暴露服務介面

this.exporters.add(exporter);

}package com.alibaba.dubbo.rpc.protocol.rest;

public class restprotocol extends abstractproxyprotocol

protected runnable doexport(t impl, classtype, url url) throws rpcexception else if (prefix.length() == 1)

// 省略建立endpoint

}

jaxrs 和webservice不衝突

jaxrs 可以使用rest 協議代替,最終都交給rest協議來完成功能

dubbo服務暴露 本地暴露(二)

serviceconfig類 private void doexporturlsfor1protocol protocolconfig protocolconfig,list registryurls 我們進入這個方法 我們先看proxyfactory.getinvoker 方法,它是生成乙個inv...

Dubbo服務暴露流程

本篇部落格,需要先看上篇 dubbo服務暴露流程 先看 dubbonamespacehandler類的 init方法,在定義屬性的時候有這樣一行 this registerbeandefinitionparser service new dubbobeandefinitionparser servi...

dubbo服務暴露的原理

使用dubbo也有一段時間了,一開始啃文件的時候都是做的書面筆記,現在搬運到部落格來。1 afterpropertiesset 呼叫 setprovider setmodules setprotocol,將配置的資訊都儲存起來 3 doexport執行暴露 4 doexporturls執行暴露位址,...