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

Multiple @Reference annotations only have one effect #4674

Closed
bigwg opened this issue Jul 26, 2019 · 2 comments
Closed

Multiple @Reference annotations only have one effect #4674

bigwg opened this issue Jul 26, 2019 · 2 comments
Assignees
Milestone

Comments

@bigwg
Copy link
Contributor

bigwg commented Jul 26, 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.7.3
  • Operating System version: Windows 10
  • Java version: Oracle JDK 1.8

Steps to reproduce this issue

  1. Inject a DubboService into a spring bean with @reference(async = true)
  2. Inject the same DubboService into another spring bean with @reference(async = false)
  3. Invoke the methods in these two beans

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

One bean is an asynchronous call and the other is a synchronous call

Actual Result

They are all asynchronous or synchronous

@Component("demoServiceComponent")
public class DemoServiceComponent implements DemoService {

    @Reference(async = true)
    private DemoService demoService;

    @Override
    public String sayHello(String name) {
        return demoService.sayHello(name);
    }
}

@Service("helloService")
public class HelloService {

    @Reference(async = false)
    private DemoService demoService;

    public String sayHello(String name) {
        return demoService.sayHello(name);
    }
}

public static void main(String[] args) {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConsumerConfiguration.class);
    context.start();
    DemoService service = context.getBean("demoServiceComponent", DemoServiceComponent.class);
    HelloService helloService = context.getBean("helloService", HelloService.class);
    System.out.println("result : " + service.sayHello("sync"));
    System.out.println("result : " + helloService.sayHello("async"));
}
@bigwg
Copy link
Contributor Author

bigwg commented Jul 27, 2019

@mercyblitz Which @reference configuration can be use is depends on spring's load order, such as I have a default @reference and a custom @reference, I expect custom @reference work, but spring may load bean first which use default @reference,I think that is a problem

@bigwg bigwg closed this as completed Jul 28, 2019
@bigwg bigwg reopened this Jul 28, 2019
@bigwg
Copy link
Contributor Author

bigwg commented Jul 28, 2019

The problem still exists.

@beiwei30 beiwei30 added this to the 2.7.4 milestone Jul 30, 2019
tswstarplanet added a commit to tswstarplanet/dubbo that referenced this issue Aug 1, 2019
tswstarplanet added a commit to tswstarplanet/dubbo that referenced this issue Aug 2, 2019
tswstarplanet added a commit to tswstarplanet/dubbo that referenced this issue Aug 2, 2019
tswstarplanet added a commit to tswstarplanet/dubbo that referenced this issue Aug 2, 2019
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

Successfully merging a pull request may close this issue.

3 participants