<ul dir="auto">
<li>[√] 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>[√] 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: Oracle JDK 1.8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>Inject a DubboService into a spring bean with <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/reference/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/reference">@reference</a>(async = true)</li>
<li>Inject the same DubboService into another spring bean with <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/reference/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/reference">@reference</a>(async = false)</li>
<li>Invoke the methods in these two beans</li>
</ol>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">One bean is an asynchronous call and the other is a synchronous call</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">They are all asynchronous or synchronous</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@Component(&quot;demoServiceComponent&quot;)
public class DemoServiceComponent implements DemoService {

    @Reference(async = true)
    private DemoService demoService;

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

@Service(&quot;helloService&quot;)
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(&quot;demoServiceComponent&quot;, DemoServiceComponent.class);
    HelloService helloService = context.getBean(&quot;helloService&quot;, HelloService.class);
    System.out.println(&quot;result : &quot; + service.sayHello(&quot;sync&quot;));
    System.out.println(&quot;result : &quot; + helloService.sayHello(&quot;async&quot;));
}"><pre class="notranslate"><code class="notranslate">@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"));
}
</code></pre></div>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> 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"> 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: all</li>
<li>Operating System version: all</li>
<li>Java version: 1.8</li>
</ul>
<p dir="auto">org.apache.dubbo.common.bytecode.Proxy use WeakHashMap to cache generated dynamic proxy, but the WeakHashMap's value be gced, so if we create many ReferenceConfig(for one service interface), then org.apache.dubbo.common.bytecode.Proxy would generate many dynamic proxy class.</p>