<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/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/dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h2 dir="auto"></h2>
<p dir="auto">In master branch,code of getAuthority() is just like this:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="public String getAuthority() {
        if (StringUtils.isEmpty(username)
                &amp;&amp; StringUtils.isEmpty(password)) {
            return null;
        }
        return (username == null ? &quot;&quot; : username)
                + &quot;:&quot; + (password == null ? &quot;&quot; : password);
    }"><pre class="notranslate"><span class="pl-k">public</span> <span class="pl-smi">String</span> <span class="pl-s1">getAuthority</span>() {
        <span class="pl-k">if</span> (<span class="pl-smi">StringUtils</span>.<span class="pl-en">isEmpty</span>(<span class="pl-s1">username</span>)
                &amp;&amp; <span class="pl-smi">StringUtils</span>.<span class="pl-en">isEmpty</span>(<span class="pl-s1">password</span>)) {
            <span class="pl-k">return</span> <span class="pl-c1">null</span>;
        }
        <span class="pl-k">return</span> (<span class="pl-s1">username</span> == <span class="pl-c1">null</span> ? <span class="pl-s">""</span> : <span class="pl-s1">username</span>)
                + <span class="pl-s">":"</span> + (<span class="pl-s1">password</span> == <span class="pl-c1">null</span> ? <span class="pl-s">""</span> : <span class="pl-s1">password</span>);
    }</pre></div>
<p dir="auto">if username is 'admin' and password is null，the return value will be 'admin:'。Is it right?Also I think null check of username is unnecessary.<br>
Is the below code is better?</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="public String getAuthority() {
        if (StringUtils.isEmpty(username)
                &amp;&amp; StringUtils.isEmpty(password)) {
            return null;
        }
        return username + (password == null ? &quot;&quot; : &quot;:&quot; + password);
    }"><pre class="notranslate"><span class="pl-k">public</span> <span class="pl-smi">String</span> <span class="pl-s1">getAuthority</span>() {
        <span class="pl-k">if</span> (<span class="pl-smi">StringUtils</span>.<span class="pl-en">isEmpty</span>(<span class="pl-s1">username</span>)
                &amp;&amp; <span class="pl-smi">StringUtils</span>.<span class="pl-en">isEmpty</span>(<span class="pl-s1">password</span>)) {
            <span class="pl-k">return</span> <span class="pl-c1">null</span>;
        }
        <span class="pl-k">return</span> <span class="pl-s1">username</span> + (<span class="pl-s1">password</span> == <span class="pl-c1">null</span> ? <span class="pl-s">""</span> : <span class="pl-s">":"</span> + <span class="pl-s1">password</span>);
    }</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: 2.6.5</li>
<li>Spring boot version: 2.1.8.RELEASE</li>
<li>Java version: 1.8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>项目启动过程中，扫描到Service注解的类；</li>
<li>在export()的过程中，在2.6.5版本新加了publishExportEvent();的操作；</li>
<li>内部的方法是ServiceBeanExportedEvent的事件监听；<br>
4.applicationEventPublisher.publishEvent(exportEvent);这个方法的applicationEventPublisher为null，抛出了空指针异常；<br>
5.ServiceBean方法实现了ApplicationEventPublisherAware接口，但是却没有调用其中的方法setApplicationEventPublisher方法；</li>
</ol>
<h3 dir="auto">Message</h3>
<p dir="auto">萌新一个，最近在学习Dubbo，遇到这个问题，自己查了很多资料没有解决，还请各位大佬帮忙看一下，感谢。</p>