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

[GitHub] zonghaishang closed pull request #1550: [Dubbo-Fix EnableDubbo annotation bug]

zonghaishang closed pull request #1550: [Dubbo-Fix EnableDubbo annotation bug]
URL: https://github.com/apache/incubator-dubbo/pull/1550
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractConfig.java
index caa14a53af..5561feefe6 100644
--- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractConfig.java
+++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractConfig.java
@@ -164,7 +164,7 @@ protected static void appendProperties(AbstractConfig config) {
         }
     }
 
-    private static String getTagName(Class<?> cls) {
+    protected static String getTagName(Class<?> cls) {
         String tag = cls.getSimpleName();
         for (String suffix : SUFFIXES) {
             if (tag.endsWith(suffix)) {
@@ -288,7 +288,7 @@ protected static void appendAttributes(Map<Object, Object> parameters, Object co
         }
     }
 
-    private static boolean isPrimitive(Class<?> type) {
+    protected static boolean isPrimitive(Class<?> type) {
         return type.isPrimitive()
                 || type == String.class
                 || type == Character.class
diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ReferenceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ReferenceConfig.java
index 1cb58ae28d..573da510f4 100644
--- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ReferenceConfig.java
+++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ReferenceConfig.java
@@ -186,10 +186,10 @@ private void init() {
         if (initialized) {
             return;
         }
-        initialized = true;
         if (interfaceName == null || interfaceName.length() == 0) {
             throw new IllegalStateException("<dubbo:reference interface=\"\" /> interface not allow null!");
         }
+        initialized = true;
         // get consumer's global configuration
         checkDefault();
         appendProperties(this);
diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java
index 853ece2eaa..a970bcc083 100644
--- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java
+++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java
@@ -223,10 +223,10 @@ protected synchronized void doExport() {
         if (exported) {
             return;
         }
-        exported = true;
         if (interfaceName == null || interfaceName.length() == 0) {
             throw new IllegalStateException("<dubbo:service interface=\"\" /> interface not allow null!");
         }
+        exported = true;
         checkDefault();
         if (provider != null) {
             if (application == null) {
diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ReferenceBean.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ReferenceBean.java
index f3aa9b0249..7c496db2c7 100644
--- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ReferenceBean.java
+++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ReferenceBean.java
@@ -33,6 +33,8 @@
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
 
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -177,4 +179,51 @@ public void afterPropertiesSet() throws Exception {
     public void destroy() {
         // do nothing
     }
+
+    @Override
+    public String toString() {
+        try {
+            StringBuilder buf = new StringBuilder();
+            buf.append("<dubbo:");
+            buf.append(getTagName(getClass()));
+            Method[] methods = getClass().getMethods();
+            for (Method method : methods) {
+                try {
+                    String name = method.getName();
+                    if ((name.startsWith("get") || name.startsWith("is"))
+                            && !"getClass".equals(name) && !"get".equals(name) && !"is".equals(name)
+                            && Modifier.isPublic(method.getModifiers())
+                            && method.getParameterTypes().length == 0
+                            && isPrimitive(method.getReturnType())) {
+                        int i = name.startsWith("get") ? 3 : 2;
+                        String key = name.substring(i, i + 1).toLowerCase() + name.substring(i + 1);
+
+                        /**
+                         *  fix factory bean recursive calls getObject because of toString method,
+                         *  causes the reference bean object to be initialized prematurely.
+                         */
+                        if(this instanceof FactoryBean && "object".equals(key)){
+                            continue;
+                        }
+
+                        Object value = method.invoke(this, new Object[0]);
+                        if (value != null) {
+                            buf.append(" ");
+                            buf.append(key);
+                            buf.append("=\"");
+                            buf.append(value);
+                            buf.append("\"");
+                        }
+                    }
+                } catch (Exception e) {
+                    logger.warn(e.getMessage(), e);
+                }
+            }
+            buf.append(" />");
+            return buf.toString();
+        } catch (Throwable t) {
+            logger.warn(t.getMessage(), t);
+            return super.toString();
+        }
+    }
 }
\ No newline at end of file
diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ServiceBean.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ServiceBean.java
index 2e614efdb6..2c95904c8d 100644
--- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ServiceBean.java
+++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ServiceBean.java
@@ -25,6 +25,7 @@
 import com.alibaba.dubbo.config.ServiceConfig;
 import com.alibaba.dubbo.config.annotation.Service;
 import com.alibaba.dubbo.config.spring.extension.SpringExtensionFactory;
+import com.alibaba.dubbo.config.support.Parameter;
 
 import org.springframework.aop.support.AopUtils;
 import org.springframework.beans.factory.BeanFactoryUtils;
@@ -36,6 +37,8 @@
 import org.springframework.context.ApplicationListener;
 import org.springframework.context.event.ContextRefreshedEvent;
 import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.core.PriorityOrdered;
+import org.springframework.core.annotation.Order;
 
 import java.lang.reflect.Method;
 import java.util.ArrayList;
@@ -47,7 +50,7 @@
  *
  * @export
  */
-public class ServiceBean<T> extends ServiceConfig<T> implements InitializingBean, DisposableBean, ApplicationContextAware, ApplicationListener<ContextRefreshedEvent>, BeanNameAware {
+public class ServiceBean<T> extends ServiceConfig<T> implements InitializingBean, DisposableBean, ApplicationContextAware, ApplicationListener<ContextRefreshedEvent>, BeanNameAware, PriorityOrdered {
 
     private static final long serialVersionUID = 213195494150089726L;
 
@@ -275,4 +278,13 @@ protected Class getServiceClass(T ref) {
         }
         return super.getServiceClass(ref);
     }
+
+    /**
+     *  Support for annotations to delay refer.
+     */
+    @Parameter(excluded = true)
+    @Override
+    public int getOrder() {
+        return 0;
+    }
 }
\ No newline at end of file
diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ReferenceAnnotationBeanPostProcessor.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ReferenceAnnotationBeanPostProcessor.java
index d8411de364..4876758371 100644
--- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ReferenceAnnotationBeanPostProcessor.java
+++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ReferenceAnnotationBeanPostProcessor.java
@@ -18,6 +18,7 @@
 
 import com.alibaba.dubbo.config.annotation.Reference;
 import com.alibaba.dubbo.config.spring.ReferenceBean;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.springframework.beans.BeanUtils;
@@ -32,6 +33,8 @@
 import org.springframework.beans.factory.support.RootBeanDefinition;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
+import org.springframework.context.ApplicationListener;
+import org.springframework.context.event.ContextRefreshedEvent;
 import org.springframework.core.PriorityOrdered;
 import org.springframework.util.ClassUtils;
 import org.springframework.util.ReflectionUtils;
@@ -42,8 +45,10 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
@@ -60,7 +65,7 @@
  */
 public class ReferenceAnnotationBeanPostProcessor extends InstantiationAwareBeanPostProcessorAdapter
         implements MergedBeanDefinitionPostProcessor, PriorityOrdered, ApplicationContextAware, BeanClassLoaderAware,
-        DisposableBean {
+        DisposableBean, ApplicationListener<ContextRefreshedEvent> {
 
     /**
      * The bean name of {@link ReferenceAnnotationBeanPostProcessor}
@@ -76,25 +81,19 @@
     private final ConcurrentMap<String, InjectionMetadata> injectionMetadataCache =
             new ConcurrentHashMap<String, InjectionMetadata>(256);
 
+    private final ConcurrentMap<String, MetadataHolder> injectionMetadataHolderCache =
+            new ConcurrentHashMap<String, MetadataHolder>(256);
+
     private final ConcurrentMap<String, ReferenceBean<?>> referenceBeansCache =
             new ConcurrentHashMap<String, ReferenceBean<?>>();
 
     @Override
     public PropertyValues postProcessPropertyValues(
             PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) throws BeanCreationException {
-
-        InjectionMetadata metadata = findReferenceMetadata(beanName, bean.getClass(), pvs);
-        try {
-            metadata.inject(bean, beanName, pvs);
-        } catch (BeanCreationException ex) {
-            throw ex;
-        } catch (Throwable ex) {
-            throw new BeanCreationException(beanName, "Injection of @Reference dependencies failed", ex);
-        }
+        injectionMetadataHolderCache.put(beanName, new MetadataHolder(bean, beanName, pvs));
         return pvs;
     }
 
-
     /**
      * Finds {@link InjectionMetadata.InjectedElement} Metadata from annotated {@link Reference @Reference} fields
      *
@@ -259,6 +258,25 @@ public void setBeanClassLoader(ClassLoader classLoader) {
         this.classLoader = classLoader;
     }
 
+    @Override
+    public void onApplicationEvent(ContextRefreshedEvent event) {
+        Iterator<Map.Entry<String, MetadataHolder>> iterator = injectionMetadataHolderCache.entrySet().iterator();
+        while (iterator.hasNext()) {
+            Map.Entry<String, MetadataHolder> entry = iterator.next();
+            String beanName = entry.getKey();
+            InjectionMetadata injectionMetadata = injectionMetadataCache.get(beanName);
+            if(injectionMetadata != null) {
+                MetadataHolder holder = entry.getValue();
+                try {
+                    injectionMetadata.inject(holder.bean, holder.beanName, holder.pvs);
+                } catch (BeanCreationException ex) {
+                    throw ex;
+                } catch (Throwable ex) {
+                    throw new BeanCreationException(beanName, "Injection of @Reference dependencies failed", ex);
+                }
+            }
+        }
+    }
 
     /**
      * Gets all beans of {@link ReferenceBean}
@@ -347,8 +365,6 @@ private Object buildReferenceBean(Reference reference, Class<?> referenceClass)
             referenceBeansCache.putIfAbsent(referenceBeanCacheKey, referenceBean);
 
         }
-
-
         return referenceBean.get();
     }
 
@@ -390,4 +406,18 @@ private static String resolveInterfaceName(Reference reference, Class<?> beanCla
 
     }
 
+    static class MetadataHolder {
+
+        volatile Object bean;
+        volatile Class<?> beanClass;
+        volatile PropertyValues pvs;
+        volatile String beanName;
+
+        public MetadataHolder(Object bean, String beanName, PropertyValues pvs) {
+            this.bean = bean;
+            this.beanClass = bean.getClass();
+            this.beanName = beanName;
+            this.pvs = pvs;
+        }
+    }
 }
diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationBeanPostProcessor.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationBeanPostProcessor.java
index 1d273451bf..912c181f96 100644
--- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationBeanPostProcessor.java
+++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationBeanPostProcessor.java
@@ -35,15 +35,22 @@
 import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
 import org.springframework.beans.factory.support.BeanNameGenerator;
 import org.springframework.beans.factory.support.ManagedList;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
 import org.springframework.context.EnvironmentAware;
 import org.springframework.context.ResourceLoaderAware;
 import org.springframework.context.annotation.AnnotationBeanNameGenerator;
 import org.springframework.context.annotation.AnnotationConfigUtils;
 import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
+import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.ConfigurationClassPostProcessor;
+import org.springframework.context.support.GenericApplicationContext;
 import org.springframework.core.env.Environment;
 import org.springframework.core.io.ResourceLoader;
 import org.springframework.core.type.filter.AnnotationTypeFilter;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Controller;
+import org.springframework.stereotype.Repository;
 import org.springframework.util.Assert;
 import org.springframework.util.ClassUtils;
 import org.springframework.util.CollectionUtils;
@@ -52,8 +59,11 @@
 
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import static org.springframework.beans.factory.support.BeanDefinitionBuilder.rootBeanDefinition;
@@ -68,7 +78,7 @@
  * @since 2.5.8
  */
 public class ServiceAnnotationBeanPostProcessor implements BeanDefinitionRegistryPostProcessor, EnvironmentAware,
-        ResourceLoaderAware, BeanClassLoaderAware {
+        ResourceLoaderAware, BeanClassLoaderAware, ApplicationContextAware {
 
     private final Logger logger = LoggerFactory.getLogger(getClass());
 
@@ -80,6 +90,8 @@
 
     private ClassLoader classLoader;
 
+    private ApplicationContext applicationContext;
+
     public ServiceAnnotationBeanPostProcessor(String... packagesToScan) {
         this(Arrays.asList(packagesToScan));
     }
@@ -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));
+        scanner.addExcludeFilter(new AnnotationTypeFilter(Repository.class, false));
+        scanner.addExcludeFilter(new AnnotationTypeFilter(org.springframework.stereotype.Service .class, false));
+        scanner.addExcludeFilter(new AnnotationTypeFilter(Service.class, false));
+
+        for (String packageToScan : packagesToScan) {
+
+            // Registers @Component Bean
+            scanner.scan(packageToScan);
+
+        }
+
+    }
+
+    private void deferConfiguationBeans() {
+
+        Map<String, BeanDefinition> beanDefinitionMap = new HashMap<String, BeanDefinition>();
+        String[] beanNames = applicationContext.getBeanDefinitionNames();
+
+        if(applicationContext instanceof GenericApplicationContext){
+            GenericApplicationContext context = (GenericApplicationContext) applicationContext;
+
+            for(String name : applicationContext.getBeanDefinitionNames()) {
+                BeanDefinition beanDefinition = context.getBeanDefinition(name);
+                AbstractBeanDefinition bean =
+                        beanDefinition instanceof AbstractBeanDefinition
+                                ? (AbstractBeanDefinition) beanDefinition : null;
+                try{
+                    if(bean == null) continue;
+                    Class<?> beanClass = bean.hasBeanClass() ? bean.getBeanClass() : bean.resolveBeanClass(classLoader);
+                    if(beanClass != null && beanClass.isAnnotationPresent(Configuration.class)) {
+                        beanDefinitionMap.put(name, bean);
+                    }
+                }catch (ClassNotFoundException e) {
+                    // we don't care.
+                }
+            }
+
+            /**
+             *  Configuration beans be delayed to final execution.
+             */
+            Iterator<Map.Entry<String, BeanDefinition>> iterator = beanDefinitionMap.entrySet().iterator();
+            while (iterator.hasNext()) {
+                Map.Entry<String, BeanDefinition> bean = iterator.next();
+                context.removeBeanDefinition(bean.getKey());
+                context.registerBeanDefinition(bean.getKey(), bean.getValue());
+            }
+        }
     }
 
 
@@ -123,6 +210,10 @@ private void registerServiceBeans(Set<String> packagesToScan, BeanDefinitionRegi
 
         scanner.setBeanNameGenerator(beanNameGenerator);
 
+        scanner.addExcludeFilter(new AnnotationTypeFilter(Component.class, false));
+        scanner.addExcludeFilter(new AnnotationTypeFilter(Controller.class, false));
+        scanner.addExcludeFilter(new AnnotationTypeFilter(Repository.class, false));
+
         scanner.addIncludeFilter(new AnnotationTypeFilter(Service.class));
 
         for (String packageToScan : packagesToScan) {
@@ -245,6 +336,8 @@ private void registerServiceBean(BeanDefinitionHolder beanDefinitionHolder, Bean
 
         Service service = findAnnotation(beanClass, Service.class);
 
+        if(service == null) return;
+
         Class<?> interfaceClass = resolveServiceInterfaceClass(beanClass, service);
 
         String annotatedServiceBeanName = beanDefinitionHolder.getBeanName();
@@ -467,4 +560,8 @@ public void setBeanClassLoader(ClassLoader classLoader) {
         this.classLoader = classLoader;
     }
 
+    @Override
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+        this.applicationContext = applicationContext;
+    }
 }
diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/context/annotation/DubboClassPathBeanDefinitionScanner.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/context/annotation/DubboClassPathBeanDefinitionScanner.java
index e6aaee315f..325a781488 100644
--- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/context/annotation/DubboClassPathBeanDefinitionScanner.java
+++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/context/annotation/DubboClassPathBeanDefinitionScanner.java
@@ -53,7 +53,7 @@ public DubboClassPathBeanDefinitionScanner(BeanDefinitionRegistry registry, bool
     public DubboClassPathBeanDefinitionScanner(BeanDefinitionRegistry registry, Environment environment,
                                                ResourceLoader resourceLoader) {
 
-        this(registry, false, environment, resourceLoader);
+        this(registry, true, environment, resourceLoader);
 
     }
 
diff --git a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationBeanPostProcessorTest.java b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationBeanPostProcessorTest.java
index e5714c7f25..92ef4402ba 100644
--- a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationBeanPostProcessorTest.java
+++ b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationBeanPostProcessorTest.java
@@ -18,6 +18,8 @@
 
 import com.alibaba.dubbo.config.spring.ServiceBean;
 import com.alibaba.dubbo.config.spring.api.HelloService;
+import com.alibaba.dubbo.config.spring.context.annotation.DubboComponentScan;
+
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -77,6 +79,7 @@ public void test() {
     @ImportResource("META-INF/spring/dubbo-annotation-provider.xml")
     @PropertySource("META-INF/default.properties")
     @ComponentScan("com.alibaba.dubbo.config.spring.context.annotation.provider")
+//    @DubboComponentScan("com.alibaba.dubbo.config.spring.context.annotation.provider")
     public static class TestConfiguration {
 
         @Bean
diff --git a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/context/annotation/EnableDubboTest.java b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/context/annotation/EnableDubboTest.java
index 2020bed667..0ca5859404 100644
--- a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/context/annotation/EnableDubboTest.java
+++ b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/context/annotation/EnableDubboTest.java
@@ -130,7 +130,6 @@ public void test() {
     }
 
     @EnableDubbo(scanBasePackages = "com.alibaba.dubbo.config.spring.context.annotation.provider")
-    @ComponentScan(basePackages = "com.alibaba.dubbo.config.spring.context.annotation.provider")
     @PropertySource("META-INF/dubbb-provider.properties")
     @EnableTransactionManagement
     public static class TestProviderConfiguration {
diff --git a/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/annotation/AnnotationConsumer.java b/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/annotation/AnnotationConsumer.java
index 971ab422bd..4931784d72 100644
--- a/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/annotation/AnnotationConsumer.java
+++ b/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/annotation/AnnotationConsumer.java
@@ -39,9 +39,8 @@ public static void main(String[] args) throws Exception {
     }
 
     @Configuration
-    @EnableDubbo(scanBasePackages = "com.alibaba.dubbo.examples.annotation.action", multipleConfig = true)
+    @EnableDubbo(scanBasePackages = "com.alibaba.dubbo.examples.annotation.action")
     @PropertySource("classpath:/com/alibaba/dubbo/examples/annotation/dubbo-consumer.properties")
-    @ComponentScan(value = {"com.alibaba.dubbo.examples.annotation.action"})
     static public class ConsumerConfiguration {
 
     }
diff --git a/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/annotation/AnnotationProvider.java b/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/annotation/AnnotationProvider.java
index 4f5d520118..e705925205 100644
--- a/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/annotation/AnnotationProvider.java
+++ b/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/annotation/AnnotationProvider.java
@@ -36,14 +36,13 @@ public static void main(String[] args) throws Exception {
     }
 
     @Configuration
-    @EnableDubbo(scanBasePackages = "com.alibaba.dubbo.examples.annotation.impl", multipleConfig = true)
+    @EnableDubbo(scanBasePackages = "com.alibaba.dubbo.examples.annotation.impl")
     @PropertySource("classpath:/com/alibaba/dubbo/examples/annotation/dubbo-provider.properties")
-//    @ComponentScan(value = {"com.alibaba.dubbo.examples.annotation.impl"})
     static public class ProviderConfiguration {
         @Bean
         public ProviderConfig providerConfig() {
             ProviderConfig providerConfig = new ProviderConfig();
-            providerConfig.setTimeout(1000);
+            providerConfig.setTimeout(5000);
             return providerConfig;
         }
     }
diff --git a/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/annotation/dubbo-consumer.properties b/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/annotation/dubbo-consumer.properties
index 042da5e509..af6094163a 100644
--- a/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/annotation/dubbo-consumer.properties
+++ b/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/annotation/dubbo-consumer.properties
@@ -1,5 +1,3 @@
-#<dubbo:application name="annotation-consumer"/>
-dubbo.application.application-id.name=annotation-consumer
-#<dubbo:registry id="registry-id" address="multicast://224.5.6.7:1234"/>
-dubbo.registry.registry-id.address=zookeeper://127.0.0.1:2181
+dubbo.application.name=annotation-consumer
+dubbo.registry.address=multicast://224.5.6.7:1234
 dubbo.consumer.consumer-id.timeout=3000
\ No newline at end of file
diff --git a/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/annotation/dubbo-provider.properties b/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/annotation/dubbo-provider.properties
index 0c14b04a23..4cd684ce7c 100644
--- a/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/annotation/dubbo-provider.properties
+++ b/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/annotation/dubbo-provider.properties
@@ -1,7 +1,4 @@
-#<dubbo:application id="application-id" name="dubbo-annotation-provider"/>
-dubbo.application.application-id.name=xxx
-#<dubbo:registry id="registry-id" address="multicast://224.5.6.7:1234"/>
-dubbo.registry.registry-id.address=zookeeper://127.0.0.1:2181
-#<dubbo:protocol id="protocol-id" name="dubbo" port="12345"/>
+dubbo.application.name=xxx
+dubbo.registry.address=multicast://224.5.6.7:1234
 dubbo.protocol.protocol-id.name=dubbo
 dubbo.protocol.protocol-id.port=20883
\ No newline at end of file
diff --git a/dubbo-test/pom.xml b/dubbo-test/pom.xml
index ac5c318fba..cd5990db64 100644
--- a/dubbo-test/pom.xml
+++ b/dubbo-test/pom.xml
@@ -182,6 +182,30 @@ limitations under the License.
             <artifactId>hessian-lite</artifactId>
             <version>3.2.2</version>
         </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>dubbo-serialization-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>dubbo-serialization-hessian2</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>dubbo-serialization-fst</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>dubbo-serialization-fastjson</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>dubbo-serialization-kryo</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>dubbo-serialization-jdk</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.hibernate</groupId>
             <artifactId>hibernate-validator</artifactId>


 

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