doc-exports/docs/asm/umn/asm_bestpractice_3005.html
Dong, Qiu Jian ec0b45029f ASM UMN initial version -20240425
Reviewed-by: Kovács, Zoltán <zkovacs@t-systems.com>
Co-authored-by: Dong, Qiu Jian <qiujiandong1@huawei.com>
Co-committed-by: Dong, Qiu Jian <qiujiandong1@huawei.com>
2024-09-18 09:02:28 +00:00

23 lines
2.1 KiB
HTML

<a name="asm_bestpractice_3005"></a><a name="asm_bestpractice_3005"></a>
<h1 class="topictitle1">Static Target Service</h1>
<div id="body1568601267888"><div class="section" id="asm_bestpractice_3005__section1421042416286"><h4 class="sectiontitle">Introduction</h4><p id="asm_bestpractice_3005__p1330417254285">Use <a href="https://dubbo.apache.org/en/docs/v2.7/user/references/xml/dubbo-reference/" target="_blank" rel="noopener noreferrer">dubbo:reference</a> to configure the referenced service provider in the service consumer of the Dubbo service. Use the <strong id="asm_bestpractice_3005__b105746911459">url</strong> option to define the address of the point-to-point direct connection service provider to bypass the Registry and directly call the target service.</p>
</div>
<div class="section" id="asm_bestpractice_3005__section1510833172818"><h4 class="sectiontitle">Description</h4><p id="asm_bestpractice_3005__p12186132172817">If the original Dubbo service uses the <strong id="asm_bestpractice_3005__b95719522484">.xml</strong> configuration file, only the configuration file needs to be modified.</p>
<pre class="screen" id="asm_bestpractice_3005__screen10360121814339"><strong id="asm_bestpractice_3005__b115511191332">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</strong>
&lt;beans&gt;
<em id="asm_bestpractice_3005__i115517196339">&lt;!-- </em><em id="asm_bestpractice_3005__i2551519153313">Interfaces that can be called --&gt;</em>
&lt;dubbo:reference id="helloService " interface="com.dubbo.service.HelloService " url = "dubbo://helloService:20880" /&gt;
&lt;/beans&gt;</pre>
<p id="asm_bestpractice_3005__p1824662453419">If an annotation is used to define the referenced target service, only the annotation of the target service in the code needs to be modified.</p>
<pre class="screen" id="asm_bestpractice_3005__screen532018377342"><strong id="asm_bestpractice_3005__b13340154211348">@Reference</strong>(url = "dubbo://helloService:20880")
HelloService helloService;</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="asm_bestpractice_3003.html">SDK Adaptation Mode</a></div>
</div>
</div>