<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: 2.7.4-SNAPSHOT</li>
<li>Operating System version: MacOS</li>
<li>Java version: java11</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<p dir="auto">Please see<br>
<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="463027328" data-permission-text="Title is private" data-url="https://github.com/apache/dubbo-spring-boot-project/issues/537" data-hovercard-type="issue" data-hovercard-url="/apache/dubbo-spring-boot-project/issues/537/hovercard" href="https://github.com/apache/dubbo-spring-boot-project/issues/537">apache/dubbo-spring-boot-project#537</a></p>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">What do you expected from the above steps？</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">What actually happens?</p>
<p dir="auto">If there is an exception, please attach the exception trace:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Just put your stack trace here!"><pre class="notranslate"><code class="notranslate">Just put your stack trace here!
</code></pre></div>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/apache/incubator-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" checked=""> I have checked the <a href="https://github.com/apache/incubator-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.0</li>
<li>Operating System version: mac</li>
<li>Java version: 1.8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>start the consumer without provider, and it will throw "No Provider" exception. Below is not the full of my code, simplify on the ReferenceConfig.</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="try{
  ReferenceConfigCache cache = ReferenceConfigCache.getCache();
  Object proxy = cache.get(new ReferenceConfig());
}catch (Throwable e){
  e.printStackTrace();
}"><pre class="notranslate"><code class="notranslate">try{
  ReferenceConfigCache cache = ReferenceConfigCache.getCache();
  Object proxy = cache.get(new ReferenceConfig());
}catch (Throwable e){
  e.printStackTrace();
}
</code></pre></div>
<ol start="2" dir="auto">
<li>Start the provider</li>
<li>Always get null even the provider started.<br>
Object proxyNew = cache.get(config);</li>
</ol>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">We are able to get proxy after start up the  provider.<br>
Object proxyNew = cache.get(config);</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">What actually happens?<br>
cache always return null even provider started.</p>
<p dir="auto">I think, we have to return null once consumer startup failed.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="public &lt;T&gt; T get(ReferenceConfig&lt;T&gt; referenceConfig) {
    String key = generator.generateKey(referenceConfig);

    ReferenceConfig&lt;?&gt; config = cache.get(key);
    if (config != null) {
        return (T) config.get();
    }

    T t = referenceConfig.get();
    if (null == t){
        return null;
    }else{
        cache.putIfAbsent(key, referenceConfig);
        return t;
    }
}"><pre class="notranslate"><code class="notranslate">public &lt;T&gt; T get(ReferenceConfig&lt;T&gt; referenceConfig) {
    String key = generator.generateKey(referenceConfig);

    ReferenceConfig&lt;?&gt; config = cache.get(key);
    if (config != null) {
        return (T) config.get();
    }

    T t = referenceConfig.get();
    if (null == t){
        return null;
    }else{
        cache.putIfAbsent(key, referenceConfig);
        return t;
    }
}
</code></pre></div>
<p dir="auto">Otherwise, the consumer cannot recover, as it have been initialized. The solution of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="349916544" data-permission-text="Title is private" data-url="https://github.com/apache/dubbo/issues/2233" data-hovercard-type="issue" data-hovercard-url="/apache/dubbo/issues/2233/hovercard" href="https://github.com/apache/dubbo/issues/2233">#2233</a> is not able to resolve the issue.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="private void init() {
    if (initialized) {
        return;
    }
    initialized = true;
}"><pre class="notranslate"><code class="notranslate">private void init() {
    if (initialized) {
        return;
    }
    initialized = true;
}
</code></pre></div>