<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/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/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.3</li>
<li>Operating System version: windows 10</li>
<li>Java version: 1.8</li>
</ul>
<p dir="auto">问题描述</p>
<h3 dir="auto">Dubbo 负载均衡 consumer获取provider 设置的权重时，看下面一段代码</h3>
<p dir="auto">org.apache.dubbo.rpc.cluster.loadbalance.AbstractLoadBalance类中<br>
` protected int getWeight(Invoker&lt;?&gt; invoker, Invocation invocation) {<br>
// 获取权重<br>
int weight = invoker.getUrl().getMethodParameter(invocation.getMethodName(), WEIGHT_KEY, DEFAULT_WEIGHT);</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    if (weight &gt; 0) {
        // 获取invoker的启动时间戳
        long timestamp = invoker.getUrl().getParameter(REMOTE_TIMESTAMP_KEY, 0L);
        if (timestamp &gt; 0L) {
            // 计算当前invoker已经启动了多久
            int uptime = (int) (System.currentTimeMillis() - timestamp);
            // 获取预热时间
            int warmup = invoker.getUrl().getParameter(WARMUP_KEY, DEFAULT_WARMUP);
            // 若已经启动，且尚未到达预热时间，计算预热权重
            if (uptime &gt; 0 &amp;&amp; uptime &lt; warmup) {
                weight = calculateWarmupWeight(uptime, warmup, weight);
            }
        }
    }
    // 权重是一个非负整数
    return weight &gt;= 0 ? weight : 0;
}`"><pre class="notranslate"><code class="notranslate">    if (weight &gt; 0) {
        // 获取invoker的启动时间戳
        long timestamp = invoker.getUrl().getParameter(REMOTE_TIMESTAMP_KEY, 0L);
        if (timestamp &gt; 0L) {
            // 计算当前invoker已经启动了多久
            int uptime = (int) (System.currentTimeMillis() - timestamp);
            // 获取预热时间
            int warmup = invoker.getUrl().getParameter(WARMUP_KEY, DEFAULT_WARMUP);
            // 若已经启动，且尚未到达预热时间，计算预热权重
            if (uptime &gt; 0 &amp;&amp; uptime &lt; warmup) {
                weight = calculateWarmupWeight(uptime, warmup, weight);
            }
        }
    }
    // 权重是一个非负整数
    return weight &gt;= 0 ? weight : 0;
}`
</code></pre></div>
<p dir="auto">获取String REMOTE_TIMESTAMP_KEY = "remote.timestamp"; 这个key ，在url中是没用这个key的，会默认找 default.remote.timestamp。<br>
引发的问题就是每次就是默认0，导致新加入的provider 也会有可能马上拿到。看到最新版本的dubbo中这个key更改为了timestamp。在2.7.3中是否是个bug。</p>
<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/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/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.6.0</li>
<li>Operating System version:linux</li>
<li>Java version: 1.8</li>
</ul>
<p dir="auto">this is my java config</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@Configuration
@EnableDubbo(scanBasePackages = &quot;me.stevenkin.dubbo.test.provider&quot;)
public class ProviderConfiguation {
    @Bean
    public ApplicationConfig applicationConfig() {
        ApplicationConfig applicationConfig = new ApplicationConfig();
        return applicationConfig;
    }

    @Bean
    public ConsumerConfig consumerConfig() {
        return new ConsumerConfig();
    }

    @Bean
    public ProviderConfig providerConfig() {
        return new ProviderConfig();
    }

    @Bean
    public RegistryConfig registryConfig() {
        return new RegistryConfig(&quot;zookeeper://127.0.0.1:2181&quot;);
    }

    @Bean
    public ProtocolConfig protocolConfig() {
        ProtocolConfig protocolConfig = new ProtocolConfig();
        protocolConfig.setName(&quot;dubbo&quot;);
        protocolConfig.setPort(-1);
        return protocolConfig;
    }
}"><pre class="notranslate"><code class="notranslate">@Configuration
@EnableDubbo(scanBasePackages = "me.stevenkin.dubbo.test.provider")
public class ProviderConfiguation {
    @Bean
    public ApplicationConfig applicationConfig() {
        ApplicationConfig applicationConfig = new ApplicationConfig();
        return applicationConfig;
    }

    @Bean
    public ConsumerConfig consumerConfig() {
        return new ConsumerConfig();
    }

    @Bean
    public ProviderConfig providerConfig() {
        return new ProviderConfig();
    }

    @Bean
    public RegistryConfig registryConfig() {
        return new RegistryConfig("zookeeper://127.0.0.1:2181");
    }

    @Bean
    public ProtocolConfig protocolConfig() {
        ProtocolConfig protocolConfig = new ProtocolConfig();
        protocolConfig.setName("dubbo");
        protocolConfig.setPort(-1);
        return protocolConfig;
    }
}
</code></pre></div>
<p dir="auto">then start up, this is exception stack</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Caused by: java.lang.IllegalStateException: Duplicate application configs: &lt;dubbo:application logger=&quot;slf4j&quot; /&gt; and &lt;dubbo:application /&gt;
	at com.alibaba.dubbo.config.spring.ReferenceBean.afterPropertiesSet(ReferenceBean.java:98)
	at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceBeanBuilder.postConfigureBean(ReferenceBeanBuilder.java:120)
	at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceBeanBuilder.postConfigureBean(ReferenceBeanBuilder.java:34)
	at com.alibaba.dubbo.config.spring.beans.factory.annotation.AbstractAnnotationConfigBeanBuilder.configureBean(AbstractAnnotationConfigBeanBuilder.java:106)
	at com.alibaba.dubbo.config.spring.beans.factory.annotation.AbstractAnnotationConfigBeanBuilder.build(AbstractAnnotationConfigBeanBuilder.java:72)
	at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.buildReferenceBean(ReferenceAnnotationBeanPostProcessor.java:333)
	at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.access$100(ReferenceAnnotationBeanPostProcessor.java:60)
	at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor$ReferenceFieldElement.inject(ReferenceAnnotationBeanPostProcessor.java:311)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
	at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.postProcessPropertyValues(ReferenceAnnotationBeanPostProcessor.java:87)
	... 12 more"><pre class="notranslate"><code class="notranslate">Caused by: java.lang.IllegalStateException: Duplicate application configs: &lt;dubbo:application logger="slf4j" /&gt; and &lt;dubbo:application /&gt;
	at com.alibaba.dubbo.config.spring.ReferenceBean.afterPropertiesSet(ReferenceBean.java:98)
	at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceBeanBuilder.postConfigureBean(ReferenceBeanBuilder.java:120)
	at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceBeanBuilder.postConfigureBean(ReferenceBeanBuilder.java:34)
	at com.alibaba.dubbo.config.spring.beans.factory.annotation.AbstractAnnotationConfigBeanBuilder.configureBean(AbstractAnnotationConfigBeanBuilder.java:106)
	at com.alibaba.dubbo.config.spring.beans.factory.annotation.AbstractAnnotationConfigBeanBuilder.build(AbstractAnnotationConfigBeanBuilder.java:72)
	at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.buildReferenceBean(ReferenceAnnotationBeanPostProcessor.java:333)
	at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.access$100(ReferenceAnnotationBeanPostProcessor.java:60)
	at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor$ReferenceFieldElement.inject(ReferenceAnnotationBeanPostProcessor.java:311)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
	at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.postProcessPropertyValues(ReferenceAnnotationBeanPostProcessor.java:87)
	... 12 more
</code></pre></div>