<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/apache/incubator-dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/apache/incubator-dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.7.0-SNAPSHOT</li>
<li>Operating System version: Ubuntu 18.04 LTS</li>
<li>Java version: 1.8.0_181</li>
</ul>
<h3 dir="auto">Step to reproduce this issue</h3>
<ol dir="auto">
<li>Making a breakpoint in the 83th line of class <code class="notranslate">org.apache.dubbo.config.spring.ReferenceBean</code></li>
<li>Debugging <code class="notranslate">dubbo-consumer-demo</code></li>
</ol>
<h3 dir="auto">Got an exception</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.dubbo.config.AbstractConfig.toString(AbstractConfig.java:465)
	at org.apache.dubbo.config.spring.ReferenceBean.afterPropertiesSet(ReferenceBean.java:83)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1688)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1626)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:742)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
	at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:139)
	at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:83)
	at cn.shuaijunlan.dubbo.learning.main.Main.main(Main.java:14)
Caused by: java.lang.IllegalStateException: No such application config! Please add &lt;dubbo:application name=&quot;...&quot; /&gt; to your spring config.
	at org.apache.dubbo.config.AbstractInterfaceConfig.checkApplication(AbstractInterfaceConfig.java:143)
	at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:280)
	at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:165)
	at org.apache.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:66)
	... 20 more"><pre class="notranslate"><code class="notranslate">java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.dubbo.config.AbstractConfig.toString(AbstractConfig.java:465)
	at org.apache.dubbo.config.spring.ReferenceBean.afterPropertiesSet(ReferenceBean.java:83)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1688)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1626)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:742)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
	at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:139)
	at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:83)
	at cn.shuaijunlan.dubbo.learning.main.Main.main(Main.java:14)
Caused by: java.lang.IllegalStateException: No such application config! Please add &lt;dubbo:application name="..." /&gt; to your spring config.
	at org.apache.dubbo.config.AbstractInterfaceConfig.checkApplication(AbstractInterfaceConfig.java:143)
	at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:280)
	at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:165)
	at org.apache.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:66)
	... 20 more
</code></pre></div>
<ul dir="auto">
<li>[<g-emoji class="g-emoji" alias="heavy_check_mark" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/2714.png">✔</g-emoji> ] I have searched the <a href="https://github.com/apache/dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li>[✔ ] I have checked the <a href="https://github.com/apache/dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.  // FAT 显示404，望修正</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.7.6+</li>
<li>Operating System version: macOS 10.14.5</li>
<li>Java version: AdoptOpenJDK（1.8.0_222）</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>准备 consumer 和 provider 各一个服务</li>
<li>启动 provider 的时候通过 "-Ddubbo.provider.tag=test" 指定标签</li>
<li>启动 consumer 的时候不指定 Tag 参数，即使用默认值</li>
</ol>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">在官网文档 <a href="http://dubbo.apache.org/zh-cn/docs/user/demos/routing-rule.html" rel="nofollow">路由规则</a> 最后一段是这样描述的：</p>
<p dir="auto"><code class="notranslate">request.tag未设置时，只会匹配tag为空的provider。即使集群中存在可用的服务，若 tag 不匹配也就无法调用，这与约定1不同，携带标签的请求可以降级访问到无标签的服务，但不携带标签/携带其他种类标签的请求永远无法访问到其他标签的服务。</code></p>
<p dir="auto">也就是说 consumer 不指定 tag 的时候流量将不会到达 provider，因为 provider 是带了 tag 标记的</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">实际上 consumer 是可以正常调用带tag标记的provider，这与文档中的描述不一致。在 2.7.5 中没有这个问题，根据我的排查，引入这个问题是由于增加了方法 org.apache.dubbo.registry.integration.RegistryDirectory#getConsumerUrl</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    @Override
    public URL getConsumerUrl() {
        return this.overrideDirectoryUrl;
    }"><pre class="notranslate"><code class="notranslate">    @Override
    public URL getConsumerUrl() {
        return this.overrideDirectoryUrl;
    }
</code></pre></div>
<p dir="auto">2.7.5版本之前使用的是抽象类方法 org.apache.dubbo.rpc.cluster.directory#getConsumerUrl</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    public URL getConsumerUrl() {
        return consumerUrl;
    }"><pre class="notranslate"><code class="notranslate">    public URL getConsumerUrl() {
        return consumerUrl;
    }
</code></pre></div>
<p dir="auto">经过 org.apache.dubbo.registry.integration.RegistryDirectory#mergeUrl 方法的处理之后，程序会把provider端的tag注入到属性 this.overrideDirectoryUrl中，因此 getConsumerUrl 方法返回的URL中就有了 tag 信息</p>
<p dir="auto">请问这个问题是否会被修正呢？还是我们的用法不对？</p>