You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2018/04/27 08:15:15 UTC

[GitHub] darknesstm opened a new issue #1710: 扩展点自动激活的文档说明和代码不一致

darknesstm opened a new issue #1710: 扩展点自动激活的文档说明和代码不一致
URL: https://github.com/apache/incubator-dubbo/issues/1710
 
 
   代码如下:
   
   > /dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/ExtensionLoader.java
   
   ```java
   private boolean isMatchGroup(String group, String[] groups) {
           if (group == null || group.length() == 0) {
               return true;
           }
           if (groups != null && groups.length > 0) {
               for (String g : groups) {
                   if (group.equals(g)) {
                       return true;
                   }
               }
           }
           return false;
       }
   ```
   当注解`@Activate`不设置任何属性的时候不可能被激活,因为这个方法中形参`groups`就是注解的值,为空数组时,返回false。
   
   但是文档上却说
   
   > https://dubbo.incubator.apache.org/books/dubbo-dev-book/SPI.html#fn_1
   
   ```java
   import com.alibaba.dubbo.common.extension.Activate;
   import com.alibaba.dubbo.rpc.Filter;
   
   @Activate // 无条件自动激活
   public class XxxFilter implements Filter {
       // ...
   }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org