dubbo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] mercyblitz commented on a change in pull request #1550: [Dubbo-Fix EnableDubbo annotation bug]
Date Sun, 08 Apr 2018 05:07:24 GMT
mercyblitz commented on a change in pull request #1550: [Dubbo-Fix EnableDubbo annotation bug]
URL: https://github.com/apache/incubator-dubbo/pull/1550#discussion_r179935398
 
 

 ##########
 File path: dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationBeanPostProcessor.java
 ##########
 @@ -98,13 +110,88 @@ public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry
registry) t
         Set<String> resolvedPackagesToScan = resolvePackagesToScan(packagesToScan);
 
         if (!CollectionUtils.isEmpty(resolvedPackagesToScan)) {
+
+            // register @Service
             registerServiceBeans(resolvedPackagesToScan, registry);
+
+            // register @Component
+            registerComponentBeans(resolvedPackagesToScan, registry);
         } else {
             if (logger.isWarnEnabled()) {
                 logger.warn("packagesToScan is empty , ServiceBean registry will be ignored!");
             }
         }
 
+        /**
+         * The solution to consumers early references to unexposed services.
+         */
+        deferConfiguationBeans();
+
+    }
+
+    /**
+     * Registers Beans whose classes was annotated {@link Component}
+     *
+     * @param packagesToScan The base packages to scan
+     * @param registry       {@link BeanDefinitionRegistry}
+     */
+    private void registerComponentBeans(Set<String> packagesToScan, BeanDefinitionRegistry
registry) {
+
+        DubboClassPathBeanDefinitionScanner scanner =
+                new DubboClassPathBeanDefinitionScanner(registry, environment, resourceLoader);
+
+        BeanNameGenerator beanNameGenerator = resolveBeanNameGenerator(registry);
+
+        scanner.setBeanNameGenerator(beanNameGenerator);
+
+        scanner.addExcludeFilter(new AnnotationTypeFilter(Controller.class, false));
 
 Review comment:
   It should not enumerate those Annotations,  for instance `@Configuration` will be scanned
here

----------------------------------------------------------------
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

Mime
View raw message