Issue 1:
I have searched the issues of this repository and believe that this is not a duplicate.

I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

Dubbo version: 2.7.3

Operating System version: windows 10

Java version: 1.8

问题描述

Dubbo 负载均衡 consumer获取provider 设置的权重时，看下面一段代码

org.apache.dubbo.rpc.cluster.loadbalance.AbstractLoadBalance类中

` protected int getWeight(Invoker<?> invoker, Invocation invocation) {

// 获取权重

int weight = invoker.getUrl().getMethodParameter(invocation.getMethodName(), WEIGHT_KEY, DEFAULT_WEIGHT);

if (weight > 0) {
// 获取invoker的启动时间戳
long timestamp = invoker.getUrl().getParameter(REMOTE_TIMESTAMP_KEY, 0L);
if (timestamp > 0L) {
// 计算当前invoker已经启动了多久
int uptime = (int) (System.currentTimeMillis() - timestamp);
// 获取预热时间
int warmup = invoker.getUrl().getParameter(WARMUP_KEY, DEFAULT_WARMUP);
// 若已经启动，且尚未到达预热时间，计算预热权重
if (uptime > 0 && uptime < warmup) {
weight = calculateWarmupWeight(uptime, warmup, weight);
}
}
}
// 权重是一个非负整数
return weight >= 0 ? weight : 0;
}`

获取String REMOTE_TIMESTAMP_KEY = "remote.timestamp"; 这个key ，在url中是没用这个key的，会默认找 default.remote.timestamp。

引发的问题就是每次就是默认0，导致新加入的provider 也会有可能马上拿到。看到最新版本的dubbo中这个key更改为了timestamp。在2.7.3中是否是个bug。

Issue 2:
I have searched the issues of this repository and believe that this is not a duplicate.

I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

Dubbo version: 2.6.0

Operating System version:linux

Java version: 1.8

this is my java config

@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;
}
}

then start up, this is exception stack

Caused by: java.lang.IllegalStateException: Duplicate application configs: <dubbo:application logger="slf4j" /> and <dubbo:application />
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