<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>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.7.3</li>
<li>Operating System version: mac 10.15</li>
<li>Java version: 1.8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>Spring start app</li>
</ol>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@SpringBootApplication
@EnableDubbo(multipleConfig = false)
public class RunApp {
}"><pre class="notranslate"><span class="pl-c1">@</span><span class="pl-c1">SpringBootApplication</span>
<span class="pl-c1">@</span><span class="pl-c1">EnableDubbo</span>(<span class="pl-s1">multipleConfig</span> = <span class="pl-c1">false</span>)
<span class="pl-k">public</span> <span class="pl-k">class</span> <span class="pl-smi">RunApp</span> {
}</pre></div>
<ol start="2" dir="auto">
<li>application.yml</li>
</ol>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="dubbo:
  protocol:
    register: false"><pre class="notranslate"><span class="pl-ent">dubbo</span>:
  <span class="pl-ent">protocol</span>:
    <span class="pl-ent">register</span>: <span class="pl-c1">false</span></pre></div>
<ol start="3" dir="auto">
<li>start RunApp</li>
</ol>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">Providers don't register to  registry center</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">Providers registered to registry center.<br>
Checked from dubbo admin</p>
<h3 dir="auto">Problems</h3>
<p dir="auto"><a href="http://dubbo.apache.org/en-us/docs/user/references/xml/dubbo-service.html" rel="nofollow">http://dubbo.apache.org/en-us/docs/user/references/xml/dubbo-service.html</a><br>
Attribute <code class="notranslate">register</code> is not required, should be null when not set.</p>
<p dir="auto">The default value in <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/service/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/service">@service</a> is <code class="notranslate">true</code> in v2.7.3.</p>
<h4 dir="auto">v2.6.2</h4>
<p dir="auto">com.alibaba.dubbo.config.annotation.Service</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="boolean register() default false;"><pre class="notranslate"><span class="pl-smi">boolean</span> <span class="pl-s1">register</span>() <span class="pl-s1">default</span> <span class="pl-c1">false</span>;</pre></div>
<h4 dir="auto">v2.7.3</h4>
<p dir="auto">org.apache.dubbo.config.annotation.Service</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="/**
 * Whether to register the service to register center, default value is true
 */
boolean register() default true;"><pre class="notranslate"><span class="pl-c">/**</span>
<span class="pl-c"> * Whether to register the service to register center, default value is true</span>
<span class="pl-c"> */</span>
<span class="pl-smi">boolean</span> <span class="pl-s1">register</span>() <span class="pl-s1">default</span> <span class="pl-c1">true</span>;</pre></div>
<p dir="auto">org.apache.dubbo.config.AbstractServiceConfig</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="/**
 * Whether to register
 */
 private Boolean register = true;"><pre class="notranslate"><span class="pl-c">/**</span>
<span class="pl-c"> * Whether to register</span>
<span class="pl-c"> */</span>
 <span class="pl-k">private</span> <span class="pl-smi">Boolean</span> <span class="pl-s1">register</span> = <span class="pl-c1">true</span>;</pre></div>
<p dir="auto">ServiceBean.register default value is true。(should be null)</p>
<p dir="auto">org.apache.dubbo.config.ServiceConfig</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="doExportUrlsFor1Protocol(ProtocolConfig protocolConfig, List&lt;URL&gt; registryURLs){
  ......
  appendParameters(map, provider);
  appendParameters(map, protocolConfig);
  appendParameters(map, this);// default: this.register=true (unset on @Service)
  ......
}"><pre class="notranslate"><span class="pl-en">doExportUrlsFor1Protocol</span>(<span class="pl-smi">ProtocolConfig</span> <span class="pl-s1">protocolConfig</span>, <span class="pl-s1">List</span>&lt;<span class="pl-c1">URL</span>&gt; <span class="pl-s1">registryURLs</span>){
  ......
  <span class="pl-en">appendParameters</span>(<span class="pl-s1">map</span>, <span class="pl-s1">provider</span>);
  <span class="pl-en">appendParameters</span>(<span class="pl-s1">map</span>, <span class="pl-s1">protocolConfig</span>);
  <span class="pl-en">appendParameters</span>(<span class="pl-s1">map</span>, <span class="pl-smi">this</span>);<span class="pl-c">// default: this.register=true (unset on @Service)</span>
  ......
}</pre></div>
<p dir="auto"><code class="notranslate">this.register</code> has default value(from AbstractServiceConfig), can't be overrided by protocolConfig.</p>
<h3 dir="auto">fix</h3>
<p dir="auto">org.apache.dubbo.config.AbstractServiceConfig</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="/**
 * Whether to register
 */
 private Boolean register;"><pre class="notranslate"><span class="pl-c">/**</span>
<span class="pl-c"> * Whether to register</span>
<span class="pl-c"> */</span>
 <span class="pl-k">private</span> <span class="pl-smi">Boolean</span> <span class="pl-s1">register</span>;</pre></div>
<p dir="auto">Change to null on unset.</p>
<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"> 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.1</li>
<li>Operating System version: any</li>
<li>Java version: any</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<p dir="auto">Code:<br>
NetUtils.java</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="    static boolean isValidPublicAddress(InetAddress address) {
        return !address.isSiteLocalAddress() &amp;&amp; !address.isLoopbackAddress();
    }"><pre class="notranslate">    <span class="pl-k">static</span> <span class="pl-smi">boolean</span> <span class="pl-s1">isValidPublicAddress</span>(<span class="pl-smi">InetAddress</span> <span class="pl-s1">address</span>) {
        <span class="pl-k">return</span> !<span class="pl-s1">address</span>.<span class="pl-en">isSiteLocalAddress</span>() &amp;&amp; !<span class="pl-s1">address</span>.<span class="pl-en">isLoopbackAddress</span>();
    }</pre></div>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">A link local address like 169.254.0.0/16 should not pass the check.</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">The link local address can be taken to publish service.</p>