Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

同一个dubbo服务一个微服务内多个类引用时,有些类的此dubbo服务reference注解属性不起作用 #4470

Closed
2 tasks
jufeng98 opened this issue Jul 5, 2019 · 7 comments
Assignees
Milestone

Comments

@jufeng98
Copy link

jufeng98 commented Jul 5, 2019

  • 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.2
  • Operating System version:Windows10
  • Java version: 1.8

Steps to reproduce this issue

  1. 同一个微服务多个类引用同样的dubbo服务
  2. 每个类的reference除了version和group一样之外,其它属性均有不一样的配置
  3. 项目运行起来后有些类的此dubbo服务reference注解属性不起作用

我看了源码,是这里的问题:
/**
* Generate a cache key of {@link ReferenceBean}
*
* @param reference {@link Reference}
* @param beanClass {@link Class}
* @return
*/
private String generateReferenceBeanCacheKey(Reference reference, Class<?> beanClass) {

    String interfaceName = resolveInterfaceName(reference, beanClass);

    String key = reference.url() + "/" + interfaceName +
            "/" + reference.version() +
            "/" + reference.group();

    Environment environment = applicationContext.getEnvironment();

    key = environment.resolvePlaceholders(key);

    return key;

}

这里会缓存dubbo service,但是key应该由所有reference属性组成才对

@chickenlj
Copy link
Contributor

Maybe we should count reference id as part of the key.

String key = reference.id() + "/" + interfaceName +
            "/" + reference.version() +
            "/" + reference.group();

@chickenlj chickenlj added this to the 2.7.4 milestone Jul 8, 2019
@jufeng98
Copy link
Author

jufeng98 commented Jul 8, 2019

那是极好的,可以解决这个问题

@mercyblitz
Copy link
Contributor

This issue has been fixed, please update 2.6.6~ or refer

protected String buildInjectedObjectCacheKey(Reference reference, Object bean, String beanName,

@jufeng98
Copy link
Author

jufeng98 commented Jul 8, 2019

我看了2.6.6版本,问题并得到没有解决
image
timeout和retries属性完全被忽略
image
image
仍然未考虑到其它Reference属性

@mercyblitz
Copy link
Contributor

Please wait for 2.6.7

@mercyblitz
Copy link
Contributor

It's still an issue for local @Servnce that was referenced by multiple @Reference with different attributes. If the service annotated @Servnce is remote, it works.

@tswstarplanet
Copy link
Contributor

duplicate to #4674

mercyblitz added a commit to mercyblitz/dubbo that referenced this issue Sep 9, 2019
mercyblitz added a commit that referenced this issue Sep 9, 2019
* Polish /#4687 : Remove the duplicated test code in dubbo-config-spring

* Polish /#4674 & /#4470
mercyblitz added a commit that referenced this issue Sep 23, 2019
* Polish /#4687 : Remove the duplicated test code in dubbo-config-spring

* Polish /#4674 & /#4470

* Polish /#5093 : Revert the previous commit

* Polish #5093 : [Feature] Dubbo Services generate the metadata of REST services
mercyblitz added a commit that referenced this issue Feb 17, 2020
* Polish /#4687 : Remove the duplicated test code in dubbo-config-spring

* Polish /#4674 & /#4470

* Polish /#5093 : Revert the previous commit

* Polish #5093 : [Feature] Dubbo Services generate the metadata of REST services

* Polish #5306 : [Migration] Upgrade the @SInCE tags in Javadoc migration cloud native to master

* Polish #5306 : [Migration] Upgrade the @SInCE tags in Javadoc migration cloud native to master

* Polish #5309 : [ISSURE] The beans of Dubbo's Config can't be found on the ReferenceBean's initialization

* Polish #5312 : Resolve the demos' issues of zookeeper and nacos

* Polish #5313 : [Migration] migrate the code in common module from cloud-native branch to master

* Polish #5316 : [Refactor] Replace @EnableDubboConfigBinding Using spring-context-support

* Polish #5317 : [Refactor] Refactor ReferenceAnnotationBeanPostProcessor using Alibaba spring-context-suuport API

* Polish #5321 : Remove BeanFactoryUtils

* Polish #5321 : Remove AnnotatedBeanDefinitionRegistryUtils

* Polish #5321 : Remove AnnotationUtils

* Polish #5321 : Remove ClassUtils

* Polish #5321 : Remove BeanRegistrar

* Polish #5321 : Remove ObjectUtils

* Polish #5321 : Remove PropertySourcesUtils

* Polish #5325 : [Migration] To migrate dubbo-metadata-api from cloud-native branch

* Polish #5326 : [Migration] To migrate dubbo-metadata-processor from cloud-native branch

* Polish #5329 : [Feature] To add the default metadata into ServiceInstance

* Polish #5339 : [Refactor] Refactor the DynamicConfiguration interface

* Polish bugfix

* Fixes test cases

* Merge remote-tracking branch 'upstream/master' into cloud-native-2.7.5

# Conflicts:
#	dubbo-configcenter/dubbo-configcenter-zookeeper/src/test/java/org/apache/dubbo/configcenter/support/zookeeper/ZookeeperDynamicConfigurationTest.java
#	dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/DynamicConfigurationServiceNameMappingTest.java

* Merge remote-tracking branch 'upstream/master' into cloud-native-2.7.5

# Conflicts:
#	dubbo-configcenter/dubbo-configcenter-zookeeper/src/test/java/org/apache/dubbo/configcenter/support/zookeeper/ZookeeperDynamicConfigurationTest.java
#	dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/DynamicConfigurationServiceNameMappingTest.java

* Polish /#5721 : [Enhancement] Setting the default IDs for Dubbo's Config Beans

* Polish /#5729 : [Optimization] To remove EnableDubboConfigBinding and EnableDubboConfigBindings

* Polish /#5594 : [Feature] Add the resolver of ServiceRestMetadata based on Java Reflection

* Polish /#5736 : [Feature] Introducing Conversion features

* Polish /#5737 : [Feature] Introducing "dubbo-metadata-processor" module

* Polish /#5594 : Change the Metadata implementation

* Polish /#5594 : Fixed test cases

* Polish /#5594 : Fixed test cases

* Polish /#5594 : Fixed test cases

* Polish /#5594 : Fixed test cases

* Polish /#5594 : Fixed test cases

* Polish /#5594 : Fixed test cases

* Polish /#5594 : Fixed test cases

* Polish /#5594 : Fixed test cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants