From 00e698822f1114220b1676ef41b8840c4d868522 Mon Sep 17 00:00:00 2001 From: liaozan <378024053@qq.com> Date: Wed, 9 May 2018 17:08:51 +0800 Subject: [PATCH 1/5] Remove unnecessary null check. --- .../dubbo/config/spring/AnnotationBean.java | 79 +++++++++++-------- 1 file changed, 45 insertions(+), 34 deletions(-) diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java index bbb75d9efd1..c3d9314231c 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java @@ -93,7 +93,7 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) try { // init scanner Class scannerClass = ReflectUtils.forName("org.springframework.context.annotation.ClassPathBeanDefinitionScanner"); - Object scanner = scannerClass.getConstructor(new Class[]{BeanDefinitionRegistry.class, boolean.class}).newInstance(new Object[]{(BeanDefinitionRegistry) beanFactory, true}); + Object scanner = scannerClass.getConstructor(new Class[]{BeanDefinitionRegistry.class, boolean.class}).newInstance(beanFactory, true); // add filter Class filterClass = ReflectUtils.forName("org.springframework.core.type.filter.AnnotationTypeFilter"); Object filter = filterClass.getConstructor(Class.class).newInstance(Service.class); @@ -101,7 +101,7 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) addIncludeFilter.invoke(scanner, filter); // scan packages String[] packages = Constants.COMMA_SPLIT_PATTERN.split(annotationPackage); - Method scan = scannerClass.getMethod("scan", new Class[]{String[].class}); + Method scan = scannerClass.getMethod("scan", String[].class); scan.invoke(scanner, new Object[]{packages}); } catch (Throwable e) { // spring 2.0 @@ -110,7 +110,7 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) } @Override - public void destroy() throws Exception { + public void destroy() { // This will only be called for singleton scope bean, and expected to be called by spring shutdown hook when BeanFactory/ApplicationContext destroys. // We will guarantee dubbo related resources being released with dubbo shutdown hook. @@ -152,37 +152,42 @@ public Object postProcessAfterInitialization(Object bean, String beanName) } if (applicationContext != null) { serviceConfig.setApplicationContext(applicationContext); - if (service.registry() != null && service.registry().length > 0) { + service.registry(); + if (service.registry().length > 0) { List registryConfigs = new ArrayList(); for (String registryId : service.registry()) { if (registryId != null && registryId.length() > 0) { - registryConfigs.add((RegistryConfig) applicationContext.getBean(registryId, RegistryConfig.class)); + registryConfigs.add(applicationContext.getBean(registryId, RegistryConfig.class)); } } serviceConfig.setRegistries(registryConfigs); } - if (service.provider() != null && service.provider().length() > 0) { - serviceConfig.setProvider((ProviderConfig) applicationContext.getBean(service.provider(), ProviderConfig.class)); + service.provider(); + if (service.provider().length() > 0) { + serviceConfig.setProvider(applicationContext.getBean(service.provider(), ProviderConfig.class)); } - if (service.monitor() != null && service.monitor().length() > 0) { - serviceConfig.setMonitor((MonitorConfig) applicationContext.getBean(service.monitor(), MonitorConfig.class)); + service.monitor(); + if (service.monitor().length() > 0) { + serviceConfig.setMonitor(applicationContext.getBean(service.monitor(), MonitorConfig.class)); } - if (service.application() != null && service.application().length() > 0) { - serviceConfig.setApplication((ApplicationConfig) applicationContext.getBean(service.application(), ApplicationConfig.class)); + service.application(); + if (service.application().length() > 0) { + serviceConfig.setApplication(applicationContext.getBean(service.application(), ApplicationConfig.class)); } - if (service.module() != null && service.module().length() > 0) { - serviceConfig.setModule((ModuleConfig) applicationContext.getBean(service.module(), ModuleConfig.class)); + service.module(); + if (service.module().length() > 0) { + serviceConfig.setModule(applicationContext.getBean(service.module(), ModuleConfig.class)); } - if (service.provider() != null && service.provider().length() > 0) { - serviceConfig.setProvider((ProviderConfig) applicationContext.getBean(service.provider(), ProviderConfig.class)); - } else { - + service.provider(); + if (service.provider().length() > 0) { + serviceConfig.setProvider(applicationContext.getBean(service.provider(), ProviderConfig.class)); } - if (service.protocol() != null && service.protocol().length > 0) { + service.protocol(); + if (service.protocol().length > 0) { List protocolConfigs = new ArrayList(); for (String protocolId : service.protocol()) { if (protocolId != null && protocolId.length() > 0) { - protocolConfigs.add((ProtocolConfig) applicationContext.getBean(protocolId, ProtocolConfig.class)); + protocolConfigs.add(applicationContext.getBean(protocolId, ProtocolConfig.class)); } } serviceConfig.setProtocols(protocolConfigs); @@ -190,7 +195,7 @@ public Object postProcessAfterInitialization(Object bean, String beanName) try { serviceConfig.afterPropertiesSet(); } catch (RuntimeException e) { - throw (RuntimeException) e; + throw e; } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } @@ -219,7 +224,7 @@ public Object postProcessBeforeInitialization(Object bean, String beanName) if (reference != null) { Object value = refer(reference, method.getParameterTypes()[0]); if (value != null) { - method.invoke(bean, new Object[]{value}); + method.invoke(bean, value); } } } catch (Throwable e) { @@ -269,34 +274,40 @@ private Object refer(Reference reference, Class referenceClass) { //method.ge } if (applicationContext != null) { referenceConfig.setApplicationContext(applicationContext); - if (reference.registry() != null && reference.registry().length > 0) { + reference.registry(); + if (reference.registry().length > 0) { List registryConfigs = new ArrayList(); for (String registryId : reference.registry()) { if (registryId != null && registryId.length() > 0) { - registryConfigs.add((RegistryConfig) applicationContext.getBean(registryId, RegistryConfig.class)); + registryConfigs.add(applicationContext.getBean(registryId, RegistryConfig.class)); } } referenceConfig.setRegistries(registryConfigs); } - if (reference.consumer() != null && reference.consumer().length() > 0) { - referenceConfig.setConsumer((ConsumerConfig) applicationContext.getBean(reference.consumer(), ConsumerConfig.class)); + reference.consumer(); + if (reference.consumer().length() > 0) { + referenceConfig.setConsumer(applicationContext.getBean(reference.consumer(), ConsumerConfig.class)); } - if (reference.monitor() != null && reference.monitor().length() > 0) { - referenceConfig.setMonitor((MonitorConfig) applicationContext.getBean(reference.monitor(), MonitorConfig.class)); + reference.monitor(); + if (reference.monitor().length() > 0) { + referenceConfig.setMonitor(applicationContext.getBean(reference.monitor(), MonitorConfig.class)); } - if (reference.application() != null && reference.application().length() > 0) { - referenceConfig.setApplication((ApplicationConfig) applicationContext.getBean(reference.application(), ApplicationConfig.class)); + reference.application(); + if (reference.application().length() > 0) { + referenceConfig.setApplication(applicationContext.getBean(reference.application(), ApplicationConfig.class)); } - if (reference.module() != null && reference.module().length() > 0) { - referenceConfig.setModule((ModuleConfig) applicationContext.getBean(reference.module(), ModuleConfig.class)); + reference.module(); + if (reference.module().length() > 0) { + referenceConfig.setModule(applicationContext.getBean(reference.module(), ModuleConfig.class)); } - if (reference.consumer() != null && reference.consumer().length() > 0) { - referenceConfig.setConsumer((ConsumerConfig) applicationContext.getBean(reference.consumer(), ConsumerConfig.class)); + reference.consumer(); + if (reference.consumer().length() > 0) { + referenceConfig.setConsumer(applicationContext.getBean(reference.consumer(), ConsumerConfig.class)); } try { referenceConfig.afterPropertiesSet(); } catch (RuntimeException e) { - throw (RuntimeException) e; + throw e; } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } From a42fa2de5ba27ffaff7f16e9cc1758bb23949ee1 Mon Sep 17 00:00:00 2001 From: liaozan <378024053@qq.com> Date: Wed, 9 May 2018 17:26:53 +0800 Subject: [PATCH 2/5] Remove unnecessary null check. --- .../dubbo/config/spring/AnnotationBean.java | 40 +++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java index c3d9314231c..6c59ffc2d46 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java @@ -89,23 +89,23 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) if (annotationPackage == null || annotationPackage.length() == 0) { return; } - if (beanFactory instanceof BeanDefinitionRegistry) { - try { - // init scanner - Class scannerClass = ReflectUtils.forName("org.springframework.context.annotation.ClassPathBeanDefinitionScanner"); - Object scanner = scannerClass.getConstructor(new Class[]{BeanDefinitionRegistry.class, boolean.class}).newInstance(beanFactory, true); - // add filter - Class filterClass = ReflectUtils.forName("org.springframework.core.type.filter.AnnotationTypeFilter"); - Object filter = filterClass.getConstructor(Class.class).newInstance(Service.class); - Method addIncludeFilter = scannerClass.getMethod("addIncludeFilter", ReflectUtils.forName("org.springframework.core.type.filter.TypeFilter")); - addIncludeFilter.invoke(scanner, filter); - // scan packages - String[] packages = Constants.COMMA_SPLIT_PATTERN.split(annotationPackage); - Method scan = scannerClass.getMethod("scan", String[].class); - scan.invoke(scanner, new Object[]{packages}); - } catch (Throwable e) { - // spring 2.0 - } + if (beanFactory instanceof BeanDefinitionRegistry) { + try { + // init scanner + Class scannerClass = ReflectUtils.forName("org.springframework.context.annotation.ClassPathBeanDefinitionScanner"); + Object scanner = scannerClass.getConstructor(new Class[]{BeanDefinitionRegistry.class, boolean.class}).newInstance(new Object[]{(BeanDefinitionRegistry) beanFactory, true}); + // add filter + Class filterClass = ReflectUtils.forName("org.springframework.core.type.filter.AnnotationTypeFilter"); + Object filter = filterClass.getConstructor(Class.class).newInstance(Service.class); + Method addIncludeFilter = scannerClass.getMethod("addIncludeFilter", ReflectUtils.forName("org.springframework.core.type.filter.TypeFilter")); + addIncludeFilter.invoke(scanner, filter); + // scan packages + String[] packages = Constants.COMMA_SPLIT_PATTERN.split(annotationPackage); + Method scan = scannerClass.getMethod("scan", new Class[]{String[].class}); + scan.invoke(scanner, new Object[]{packages}); + } catch (Throwable e) { + // spring 2.0 + } } } @@ -296,12 +296,10 @@ private Object refer(Reference reference, Class referenceClass) { //method.ge if (reference.application().length() > 0) { referenceConfig.setApplication(applicationContext.getBean(reference.application(), ApplicationConfig.class)); } - reference.module(); - if (reference.module().length() > 0) { + if (reference.module() != null && reference.module().length() > 0) { referenceConfig.setModule(applicationContext.getBean(reference.module(), ModuleConfig.class)); } - reference.consumer(); - if (reference.consumer().length() > 0) { + if (reference.consumer() != null && reference.consumer().length() > 0) { referenceConfig.setConsumer(applicationContext.getBean(reference.consumer(), ConsumerConfig.class)); } try { From 3d4edd1a0df3f5ea16053576e847d58125d3c68b Mon Sep 17 00:00:00 2001 From: liaozan <378024053@qq.com> Date: Wed, 9 May 2018 17:37:11 +0800 Subject: [PATCH 3/5] Remove unnecessary null check. --- .../dubbo/config/spring/AnnotationBean.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java index 6c59ffc2d46..fabfa977fba 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java @@ -152,7 +152,6 @@ public Object postProcessAfterInitialization(Object bean, String beanName) } if (applicationContext != null) { serviceConfig.setApplicationContext(applicationContext); - service.registry(); if (service.registry().length > 0) { List registryConfigs = new ArrayList(); for (String registryId : service.registry()) { @@ -162,27 +161,21 @@ public Object postProcessAfterInitialization(Object bean, String beanName) } serviceConfig.setRegistries(registryConfigs); } - service.provider(); if (service.provider().length() > 0) { serviceConfig.setProvider(applicationContext.getBean(service.provider(), ProviderConfig.class)); } - service.monitor(); if (service.monitor().length() > 0) { serviceConfig.setMonitor(applicationContext.getBean(service.monitor(), MonitorConfig.class)); } - service.application(); if (service.application().length() > 0) { serviceConfig.setApplication(applicationContext.getBean(service.application(), ApplicationConfig.class)); } - service.module(); if (service.module().length() > 0) { serviceConfig.setModule(applicationContext.getBean(service.module(), ModuleConfig.class)); } - service.provider(); if (service.provider().length() > 0) { serviceConfig.setProvider(applicationContext.getBean(service.provider(), ProviderConfig.class)); } - service.protocol(); if (service.protocol().length > 0) { List protocolConfigs = new ArrayList(); for (String protocolId : service.protocol()) { @@ -284,22 +277,19 @@ private Object refer(Reference reference, Class referenceClass) { //method.ge } referenceConfig.setRegistries(registryConfigs); } - reference.consumer(); if (reference.consumer().length() > 0) { referenceConfig.setConsumer(applicationContext.getBean(reference.consumer(), ConsumerConfig.class)); } - reference.monitor(); if (reference.monitor().length() > 0) { referenceConfig.setMonitor(applicationContext.getBean(reference.monitor(), MonitorConfig.class)); } - reference.application(); if (reference.application().length() > 0) { referenceConfig.setApplication(applicationContext.getBean(reference.application(), ApplicationConfig.class)); } - if (reference.module() != null && reference.module().length() > 0) { + if (reference.module().length() > 0) { referenceConfig.setModule(applicationContext.getBean(reference.module(), ModuleConfig.class)); } - if (reference.consumer() != null && reference.consumer().length() > 0) { + if (reference.consumer().length() > 0) { referenceConfig.setConsumer(applicationContext.getBean(reference.consumer(), ConsumerConfig.class)); } try { From 8cf9381c17f8a4ed25ac3748827c1a874f60aa63 Mon Sep 17 00:00:00 2001 From: liaozan <378024053@qq.com> Date: Thu, 10 May 2018 16:56:48 +0800 Subject: [PATCH 4/5] change the indent from tab to space. --- .../dubbo/config/spring/AnnotationBean.java | 79 ++++++++++--------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java index fabfa977fba..659a47184dd 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java @@ -33,6 +33,7 @@ import com.alibaba.dubbo.config.ServiceConfig; import com.alibaba.dubbo.config.annotation.Reference; import com.alibaba.dubbo.config.annotation.Service; + import org.springframework.beans.BeansException; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; @@ -75,7 +76,7 @@ public String getPackage() { public void setPackage(String annotationPackage) { this.annotationPackage = annotationPackage; this.annotationPackages = (annotationPackage == null || annotationPackage.length() == 0) ? null - : Constants.COMMA_SPLIT_PATTERN.split(annotationPackage); + : Constants.COMMA_SPLIT_PATTERN.split(annotationPackage); } @Override @@ -85,27 +86,27 @@ public void setApplicationContext(ApplicationContext applicationContext) throws @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) - throws BeansException { + throws BeansException { if (annotationPackage == null || annotationPackage.length() == 0) { return; } - if (beanFactory instanceof BeanDefinitionRegistry) { - try { - // init scanner - Class scannerClass = ReflectUtils.forName("org.springframework.context.annotation.ClassPathBeanDefinitionScanner"); - Object scanner = scannerClass.getConstructor(new Class[]{BeanDefinitionRegistry.class, boolean.class}).newInstance(new Object[]{(BeanDefinitionRegistry) beanFactory, true}); - // add filter - Class filterClass = ReflectUtils.forName("org.springframework.core.type.filter.AnnotationTypeFilter"); - Object filter = filterClass.getConstructor(Class.class).newInstance(Service.class); - Method addIncludeFilter = scannerClass.getMethod("addIncludeFilter", ReflectUtils.forName("org.springframework.core.type.filter.TypeFilter")); - addIncludeFilter.invoke(scanner, filter); - // scan packages - String[] packages = Constants.COMMA_SPLIT_PATTERN.split(annotationPackage); - Method scan = scannerClass.getMethod("scan", new Class[]{String[].class}); - scan.invoke(scanner, new Object[]{packages}); - } catch (Throwable e) { - // spring 2.0 - } + if (beanFactory instanceof BeanDefinitionRegistry) { + try { + // init scanner + Class scannerClass = ReflectUtils.forName("org.springframework.context.annotation.ClassPathBeanDefinitionScanner"); + Object scanner = scannerClass.getConstructor(new Class[]{BeanDefinitionRegistry.class, boolean.class}).newInstance(new Object[]{(BeanDefinitionRegistry) beanFactory, true}); + // add filter + Class filterClass = ReflectUtils.forName("org.springframework.core.type.filter.AnnotationTypeFilter"); + Object filter = filterClass.getConstructor(Class.class).newInstance(Service.class); + Method addIncludeFilter = scannerClass.getMethod("addIncludeFilter", ReflectUtils.forName("org.springframework.core.type.filter.TypeFilter")); + addIncludeFilter.invoke(scanner, filter); + // scan packages + String[] packages = Constants.COMMA_SPLIT_PATTERN.split(annotationPackage); + Method scan = scannerClass.getMethod("scan", new Class[]{String[].class}); + scan.invoke(scanner, new Object[]{packages}); + } catch (Throwable e) { + // spring 2.0 + } } } @@ -134,7 +135,7 @@ public void destroy() { @Override public Object postProcessAfterInitialization(Object bean, String beanName) - throws BeansException { + throws BeansException { if (!isMatchPackage(bean)) { return bean; } @@ -143,7 +144,7 @@ public Object postProcessAfterInitialization(Object bean, String beanName) ServiceBean serviceConfig = new ServiceBean(service); serviceConfig.setRef(bean); if (void.class.equals(service.interfaceClass()) - && "".equals(service.interfaceName())) { + && "".equals(service.interfaceName())) { if (bean.getClass().getInterfaces().length > 0) { serviceConfig.setInterface(bean.getClass().getInterfaces()[0]); } else { @@ -152,7 +153,7 @@ public Object postProcessAfterInitialization(Object bean, String beanName) } if (applicationContext != null) { serviceConfig.setApplicationContext(applicationContext); - if (service.registry().length > 0) { + if (service.registry().length > 0) { List registryConfigs = new ArrayList(); for (String registryId : service.registry()) { if (registryId != null && registryId.length() > 0) { @@ -161,22 +162,22 @@ public Object postProcessAfterInitialization(Object bean, String beanName) } serviceConfig.setRegistries(registryConfigs); } - if (service.provider().length() > 0) { + if (service.provider().length() > 0) { serviceConfig.setProvider(applicationContext.getBean(service.provider(), ProviderConfig.class)); } - if (service.monitor().length() > 0) { + if (service.monitor().length() > 0) { serviceConfig.setMonitor(applicationContext.getBean(service.monitor(), MonitorConfig.class)); } - if (service.application().length() > 0) { + if (service.application().length() > 0) { serviceConfig.setApplication(applicationContext.getBean(service.application(), ApplicationConfig.class)); } - if (service.module().length() > 0) { + if (service.module().length() > 0) { serviceConfig.setModule(applicationContext.getBean(service.module(), ModuleConfig.class)); } - if (service.provider().length() > 0) { + if (service.provider().length() > 0) { serviceConfig.setProvider(applicationContext.getBean(service.provider(), ProviderConfig.class)); } - if (service.protocol().length > 0) { + if (service.protocol().length > 0) { List protocolConfigs = new ArrayList(); for (String protocolId : service.protocol()) { if (protocolId != null && protocolId.length() > 0) { @@ -201,7 +202,7 @@ public Object postProcessAfterInitialization(Object bean, String beanName) @Override public Object postProcessBeforeInitialization(Object bean, String beanName) - throws BeansException { + throws BeansException { if (!isMatchPackage(bean)) { return bean; } @@ -209,9 +210,9 @@ public Object postProcessBeforeInitialization(Object bean, String beanName) for (Method method : methods) { String name = method.getName(); if (name.length() > 3 && name.startsWith("set") - && method.getParameterTypes().length == 1 - && Modifier.isPublic(method.getModifiers()) - && !Modifier.isStatic(method.getModifiers())) { + && method.getParameterTypes().length == 1 + && Modifier.isPublic(method.getModifiers()) + && !Modifier.isStatic(method.getModifiers())) { try { Reference reference = method.getAnnotation(Reference.class); if (reference != null) { @@ -261,14 +262,14 @@ private Object refer(Reference reference, Class referenceClass) { //method.ge if (referenceConfig == null) { referenceConfig = new ReferenceBean(reference); if (void.class.equals(reference.interfaceClass()) - && "".equals(reference.interfaceName()) - && referenceClass.isInterface()) { + && "".equals(reference.interfaceName()) + && referenceClass.isInterface()) { referenceConfig.setInterface(referenceClass); } if (applicationContext != null) { referenceConfig.setApplicationContext(applicationContext); - reference.registry(); - if (reference.registry().length > 0) { + reference.registry(); + if (reference.registry().length > 0) { List registryConfigs = new ArrayList(); for (String registryId : reference.registry()) { if (registryId != null && registryId.length() > 0) { @@ -277,13 +278,13 @@ private Object refer(Reference reference, Class referenceClass) { //method.ge } referenceConfig.setRegistries(registryConfigs); } - if (reference.consumer().length() > 0) { + if (reference.consumer().length() > 0) { referenceConfig.setConsumer(applicationContext.getBean(reference.consumer(), ConsumerConfig.class)); } - if (reference.monitor().length() > 0) { + if (reference.monitor().length() > 0) { referenceConfig.setMonitor(applicationContext.getBean(reference.monitor(), MonitorConfig.class)); } - if (reference.application().length() > 0) { + if (reference.application().length() > 0) { referenceConfig.setApplication(applicationContext.getBean(reference.application(), ApplicationConfig.class)); } if (reference.module().length() > 0) { From 68eee35f24e5c4184db47d5e55dd4e569c49d0b0 Mon Sep 17 00:00:00 2001 From: liaozan <378024053@qq.com> Date: Sat, 12 May 2018 20:24:54 +0800 Subject: [PATCH 5/5] Remove unnecessary null check. --- .../java/com/alibaba/dubbo/config/spring/AnnotationBean.java | 1 - 1 file changed, 1 deletion(-) diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java index 659a47184dd..6da7ba8b901 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java @@ -268,7 +268,6 @@ private Object refer(Reference reference, Class referenceClass) { //method.ge } if (applicationContext != null) { referenceConfig.setApplicationContext(applicationContext); - reference.registry(); if (reference.registry().length > 0) { List registryConfigs = new ArrayList(); for (String registryId : reference.registry()) {