-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Multiple @Reference annotations only have one effect #4674
Copy link
Copy link
Closed
Milestone
Description
- [√] 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
- Inject a DubboService into a spring bean with @reference(async = true)
- Inject the same DubboService into another spring bean with @reference(async = false)
- 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"));
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.