This is an automated email from the ASF dual-hosted git repository.

mercyblitz pushed a commit to branch 0.1.1
in repository 
https://gitbox.apache.org/repos/asf/incubator-dubbo-spring-boot-project.git


The following commit(s) were added to refs/heads/0.1.1 by this push:
     new 47ba15d  Remove @EnableConfigurationProperties Beans
47ba15d is described below

commit 47ba15db5bb20209623d96de076a2492cef8d84d
Author: mercyblitz <mercybl...@gmail.com>
AuthorDate: Mon Mar 26 22:22:18 2018 +0800

    Remove @EnableConfigurationProperties Beans
---
 .../autoconfigure/DubboAutoConfiguration.java      |  17 ++-
 .../dubbo/autoconfigure/DubboConfigProperties.java |  61 ---------
 .../dubbo/autoconfigure/DubboScanProperties.java   |  53 --------
 .../MultipleDubboConfigBindingProperties.java      | 140 ---------------------
 .../autoconfigure/RelaxedDubboConfigBinder.java    |  50 ++++++++
 .../SingleDubboConfigBindingProperties.java        | 136 --------------------
 ...DubboAutoConfigurationOnMultipleConfigTest.java |  69 +---------
 .../DubboAutoConfigurationOnSingleConfigTest.java  |  37 ------
 .../RelaxedDubboConfigBinderTest.java              |  61 +++++++++
 9 files changed, 125 insertions(+), 499 deletions(-)

diff --git 
a/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/DubboAutoConfiguration.java
 
b/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/DubboAutoConfiguration.java
index 89dbefb..25bc963 100644
--- 
a/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/DubboAutoConfiguration.java
+++ 
b/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/DubboAutoConfiguration.java
@@ -26,20 +26,21 @@ import 
com.alibaba.dubbo.config.spring.context.annotation.DubboComponentScan;
 import 
com.alibaba.dubbo.config.spring.context.annotation.DubboConfigConfiguration;
 import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo;
 import com.alibaba.dubbo.config.spring.context.annotation.EnableDubboConfig;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
 import 
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.bind.RelaxedDataBinder;
 import org.springframework.boot.bind.RelaxedPropertyResolver;
-import 
org.springframework.boot.context.properties.EnableConfigurationProperties;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Scope;
 import org.springframework.core.env.Environment;
 
 import java.util.Set;
 
 import static com.alibaba.boot.dubbo.util.DubboUtils.*;
 import static java.util.Collections.emptySet;
+import static 
org.springframework.beans.factory.config.ConfigurableBeanFactory.SCOPE_PROTOTYPE;
 
 /**
  * Dubbo Auto {@link Configuration}
@@ -56,7 +57,6 @@ import static java.util.Collections.emptySet;
 @Configuration
 @ConditionalOnProperty(prefix = DUBBO_PREFIX, name = "enabled", matchIfMissing 
= true, havingValue = "true")
 @ConditionalOnClass(AbstractConfig.class)
-@EnableConfigurationProperties(value = {DubboScanProperties.class, 
DubboConfigProperties.class})
 public class DubboAutoConfiguration {
 
     /**
@@ -67,7 +67,6 @@ public class DubboAutoConfiguration {
      */
     @ConditionalOnProperty(name = MULTIPLE_CONFIG_PROPERTY_NAME, havingValue = 
"false", matchIfMissing = true)
     @EnableDubboConfig
-    @EnableConfigurationProperties(SingleDubboConfigBindingProperties.class)
     protected static class SingleDubboConfigConfiguration {
     }
 
@@ -79,7 +78,6 @@ public class DubboAutoConfiguration {
      */
     @ConditionalOnProperty(name = MULTIPLE_CONFIG_PROPERTY_NAME, havingValue = 
"true")
     @EnableDubboConfig(multiple = true)
-    @EnableConfigurationProperties(MultipleDubboConfigBindingProperties.class)
     protected static class MultipleDubboConfigConfiguration {
     }
 
@@ -89,7 +87,7 @@ public class DubboAutoConfiguration {
      * @return {@link ServiceAnnotationBeanPostProcessor}
      */
     @ConditionalOnProperty(name = BASE_PACKAGES_PROPERTY_NAME)
-    @Autowired
+    @ConditionalOnClass(RelaxedPropertyResolver.class)
     @Bean
     public ServiceAnnotationBeanPostProcessor 
serviceAnnotationBeanPostProcessor(Environment environment) {
         RelaxedPropertyResolver resolver = new 
RelaxedPropertyResolver(environment);
@@ -97,6 +95,13 @@ public class DubboAutoConfiguration {
         return new ServiceAnnotationBeanPostProcessor(packagesToScan);
     }
 
+    @ConditionalOnClass(RelaxedDataBinder.class)
+    @Bean
+    @Scope(scopeName = SCOPE_PROTOTYPE)
+    public RelaxedDubboConfigBinder relaxedDubboConfigBinder() {
+        return new RelaxedDubboConfigBinder();
+    }
+
     /**
      * Creates {@link ReferenceAnnotationBeanPostProcessor} Bean if Absent
      *
diff --git 
a/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/DubboConfigProperties.java
 
b/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/DubboConfigProperties.java
deleted file mode 100644
index 1ee5183..0000000
--- 
a/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/DubboConfigProperties.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.alibaba.boot.dubbo.autoconfigure;
-
-import com.alibaba.dubbo.common.utils.ConfigUtils;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-import static com.alibaba.boot.dubbo.util.DubboUtils.*;
-
-
-/**
- * Dubbo Config {@link ConfigurationProperties Properties} with prefix 
"dubbo.config"
- *
- * @author <a href="mailto:mercybl...@gmail.com";>Mercy</a>
- * @see ConfigurationProperties
- * @since 1.0.0
- */
-@ConfigurationProperties(prefix = DUBBO_CONFIG_PREFIX)
-public class DubboConfigProperties {
-
-    /**
-     * Indicates multiple properties binding from externalized configuration 
or not.
-     */
-    private boolean multiple = DEFAULT_MULTIPLE_CONFIG_PROPERTY_VALUE;
-
-    /**
-     * Indicates override {@link ConfigUtils#getProperties() Dubbo config 
properties} from externalized configuration
-     * or not.
-     */
-    private boolean override = DEFAULT_OVERRIDE_CONFIG_PROPERTY_VALUE;
-
-    public boolean isMultiple() {
-        return multiple;
-    }
-
-    public void setMultiple(boolean multiple) {
-        this.multiple = multiple;
-    }
-
-    public boolean isOverride() {
-        return override;
-    }
-
-    public void setOverride(boolean override) {
-        this.override = override;
-    }
-}
diff --git 
a/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/DubboScanProperties.java
 
b/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/DubboScanProperties.java
deleted file mode 100644
index 8778bf5..0000000
--- 
a/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/DubboScanProperties.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.alibaba.boot.dubbo.autoconfigure;
-
-import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import static com.alibaba.boot.dubbo.util.DubboUtils.DUBBO_SCAN_PREFIX;
-
-
-/**
- * Dubbo Scan {@link ConfigurationProperties Properties} with prefix 
"dubbo.scan"
- *
- * @author <a href="mailto:mercybl...@gmail.com";>Mercy</a>
- * @see ConfigurationProperties
- * @since 1.0.0
- */
-@ConfigurationProperties(prefix = DUBBO_SCAN_PREFIX)
-public class DubboScanProperties {
-
-    /**
-     * The basePackages to scan , the multiple-value is delimited by comma
-     *
-     * @see EnableDubbo#scanBasePackages()
-     */
-    private Set<String> basePackages = new LinkedHashSet<>();
-
-    public Set<String> getBasePackages() {
-        return basePackages;
-    }
-
-    public void setBasePackages(Set<String> basePackages) {
-        this.basePackages = basePackages;
-    }
-
-}
diff --git 
a/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/MultipleDubboConfigBindingProperties.java
 
b/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/MultipleDubboConfigBindingProperties.java
deleted file mode 100644
index 97f8912..0000000
--- 
a/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/MultipleDubboConfigBindingProperties.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.alibaba.boot.dubbo.autoconfigure;
-
-import com.alibaba.dubbo.config.*;
-import com.alibaba.dubbo.config.spring.context.annotation.EnableDubboConfig;
-import 
com.alibaba.dubbo.config.spring.context.annotation.EnableDubboConfigBinding;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import static com.alibaba.boot.dubbo.util.DubboUtils.DUBBO_PREFIX;
-
-
-/**
- * Multiple Dubbo Config Binding {@link ConfigurationProperties Properties} 
with prefix "dubbo."
- *
- * @author <a href="mailto:mercybl...@gmail.com";>Mercy</a>
- * @see ConfigurationProperties
- * @see EnableDubboConfigBinding
- * @see EnableDubboConfig#multiple()
- * @since 1.0.0
- */
-@ConfigurationProperties(prefix = DUBBO_PREFIX)
-public class MultipleDubboConfigBindingProperties {
-
-    /**
-     * Multiple {@link ApplicationConfig} property
-     */
-    
-    private Map<String, ApplicationConfig> applications = new 
LinkedHashMap<>();
-
-    /**
-     * Multiple {@link ModuleConfig} property
-     */
-    
-    private Map<String, ModuleConfig> modules = new LinkedHashMap<>();
-
-    /**
-     * Multiple {@link RegistryConfig} property
-     */
-    
-    private Map<String, RegistryConfig> registries = new LinkedHashMap<>();
-
-    /**
-     * Multiple {@link ProtocolConfig} property
-     */
-    
-    private Map<String, ProtocolConfig> protocols = new LinkedHashMap<>();
-
-    /**
-     * Multiple {@link MonitorConfig} property
-     */
-    
-    private Map<String, MonitorConfig> monitors = new LinkedHashMap<>();
-
-    /**
-     * Multiple {@link ProviderConfig} property
-     */
-    
-    private Map<String, ProviderConfig> providers = new LinkedHashMap<>();
-
-    /**
-     * Multiple {@link ConsumerConfig} property
-     */
-    
-    private Map<String, ConsumerConfig> consumers = new LinkedHashMap<>();
-
-
-    public Map<String, ApplicationConfig> getApplications() {
-        return applications;
-    }
-
-    public void setApplications(Map<String, ApplicationConfig> applications) {
-        this.applications = applications;
-    }
-
-    public Map<String, ModuleConfig> getModules() {
-        return modules;
-    }
-
-    public void setModules(Map<String, ModuleConfig> modules) {
-        this.modules = modules;
-    }
-
-    public Map<String, RegistryConfig> getRegistries() {
-        return registries;
-    }
-
-    public void setRegistries(Map<String, RegistryConfig> registries) {
-        this.registries = registries;
-    }
-
-    public Map<String, ProtocolConfig> getProtocols() {
-        return protocols;
-    }
-
-    public void setProtocols(Map<String, ProtocolConfig> protocols) {
-        this.protocols = protocols;
-    }
-
-    public Map<String, MonitorConfig> getMonitors() {
-        return monitors;
-    }
-
-    public void setMonitors(Map<String, MonitorConfig> monitors) {
-        this.monitors = monitors;
-    }
-
-    public Map<String, ProviderConfig> getProviders() {
-        return providers;
-    }
-
-    public void setProviders(Map<String, ProviderConfig> providers) {
-        this.providers = providers;
-    }
-
-    public Map<String, ConsumerConfig> getConsumers() {
-        return consumers;
-    }
-
-    public void setConsumers(Map<String, ConsumerConfig> consumers) {
-        this.consumers = consumers;
-    }
-}
diff --git 
a/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/RelaxedDubboConfigBinder.java
 
b/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/RelaxedDubboConfigBinder.java
new file mode 100644
index 0000000..e9c9707
--- /dev/null
+++ 
b/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/RelaxedDubboConfigBinder.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alibaba.boot.dubbo.autoconfigure;
+
+import com.alibaba.dubbo.config.AbstractConfig;
+import 
com.alibaba.dubbo.config.spring.context.properties.AbstractDubboConfigBinder;
+import com.alibaba.dubbo.config.spring.context.properties.DubboConfigBinder;
+import org.springframework.beans.MutablePropertyValues;
+import org.springframework.boot.bind.RelaxedDataBinder;
+
+import java.util.Map;
+
+import static 
com.alibaba.dubbo.config.spring.util.PropertySourcesUtils.getSubProperties;
+
+/**
+ * Spring Boot Relaxed {@link DubboConfigBinder} implementation
+ *
+ * @author <a href="mailto:mercybl...@gmail.com";>Mercy</a>
+ * @since 0.1.1
+ */
+public class RelaxedDubboConfigBinder extends AbstractDubboConfigBinder {
+
+    @Override
+    public <C extends AbstractConfig> void bind(String prefix, C dubboConfig) {
+        RelaxedDataBinder relaxedDataBinder = new 
RelaxedDataBinder(dubboConfig);
+        // Set ignored*
+        relaxedDataBinder.setIgnoreInvalidFields(isIgnoreInvalidFields());
+        relaxedDataBinder.setIgnoreUnknownFields(isIgnoreUnknownFields());
+        // Get properties under specified prefix from PropertySources
+        Map<String, String> properties = 
getSubProperties(getPropertySources(), prefix);
+        // Convert Map to MutablePropertyValues
+        MutablePropertyValues propertyValues = new 
MutablePropertyValues(properties);
+        // Bind
+        relaxedDataBinder.bind(propertyValues);
+    }
+}
diff --git 
a/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/SingleDubboConfigBindingProperties.java
 
b/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/SingleDubboConfigBindingProperties.java
deleted file mode 100644
index 3d15ffb..0000000
--- 
a/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/SingleDubboConfigBindingProperties.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.alibaba.boot.dubbo.autoconfigure;
-
-import com.alibaba.dubbo.config.*;
-import 
com.alibaba.dubbo.config.spring.context.annotation.EnableDubboConfigBinding;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.boot.context.properties.NestedConfigurationProperty;
-
-import static com.alibaba.boot.dubbo.util.DubboUtils.DUBBO_PREFIX;
-
-
-/**
- * Single Dubbo Config Binding {@link ConfigurationProperties Properties} with 
prefix "dubbo."
- *
- * @author <a href="mailto:mercybl...@gmail.com";>Mercy</a>
- * @see ConfigurationProperties
- * @see EnableDubboConfigBinding
- * @since 1.0.0
- */
-@ConfigurationProperties(prefix = DUBBO_PREFIX)
-public class SingleDubboConfigBindingProperties {
-
-    /**
-     * {@link ApplicationConfig} property
-     */
-    @NestedConfigurationProperty
-    private ApplicationConfig application;
-
-    /**
-     * {@link ModuleConfig} property
-     */
-    @NestedConfigurationProperty
-    private ModuleConfig module;
-
-    /**
-     * {@link RegistryConfig} property
-     */
-    @NestedConfigurationProperty
-    private RegistryConfig registry;
-
-    /**
-     * {@link ProtocolConfig} property
-     */
-    @NestedConfigurationProperty
-    private ProtocolConfig protocol;
-
-    /**
-     * {@link MonitorConfig} property
-     */
-    @NestedConfigurationProperty
-    private MonitorConfig monitor;
-
-    /**
-     * {@link ProviderConfig} property
-     */
-    @NestedConfigurationProperty
-    private ProviderConfig provider;
-
-    /**
-     * {@link ConsumerConfig} property
-     */
-    @NestedConfigurationProperty
-    private ConsumerConfig consumer;
-
-    public ApplicationConfig getApplication() {
-        return application;
-    }
-
-    public void setApplication(ApplicationConfig application) {
-        this.application = application;
-    }
-
-    public ModuleConfig getModule() {
-        return module;
-    }
-
-    public void setModule(ModuleConfig module) {
-        this.module = module;
-    }
-
-    public RegistryConfig getRegistry() {
-        return registry;
-    }
-
-    public void setRegistry(RegistryConfig registry) {
-        this.registry = registry;
-    }
-
-    public ProtocolConfig getProtocol() {
-        return protocol;
-    }
-
-    public void setProtocol(ProtocolConfig protocol) {
-        this.protocol = protocol;
-    }
-
-    public MonitorConfig getMonitor() {
-        return monitor;
-    }
-
-    public void setMonitor(MonitorConfig monitor) {
-        this.monitor = monitor;
-    }
-
-    public ProviderConfig getProvider() {
-        return provider;
-    }
-
-    public void setProvider(ProviderConfig provider) {
-        this.provider = provider;
-    }
-
-    public ConsumerConfig getConsumer() {
-        return consumer;
-    }
-
-    public void setConsumer(ConsumerConfig consumer) {
-        this.consumer = consumer;
-    }
-
-}
diff --git 
a/dubbo-spring-boot-autoconfigure/src/test/java/com/alibaba/boot/dubbo/autoconfigure/DubboAutoConfigurationOnMultipleConfigTest.java
 
b/dubbo-spring-boot-autoconfigure/src/test/java/com/alibaba/boot/dubbo/autoconfigure/DubboAutoConfigurationOnMultipleConfigTest.java
index 96bb513..75c950c 100644
--- 
a/dubbo-spring-boot-autoconfigure/src/test/java/com/alibaba/boot/dubbo/autoconfigure/DubboAutoConfigurationOnMultipleConfigTest.java
+++ 
b/dubbo-spring-boot-autoconfigure/src/test/java/com/alibaba/boot/dubbo/autoconfigure/DubboAutoConfigurationOnMultipleConfigTest.java
@@ -42,13 +42,13 @@ import static 
org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncl
 @RunWith(SpringJUnit4ClassRunner.class)
 @TestPropertySource(
         properties = {
-                "dubbo.applications.application1.name = 
dubbo-demo-application",
+                "dubbo.applications.application1.NAME = 
dubbo-demo-application",
                 "dubbo.applications.application2.name = 
dubbo-demo-application2",
                 "dubbo.modules.module1.name = dubbo-demo-module",
                 "dubbo.registries.registry1.address = 
zookeeper://192.168.99.100:32770",
                 "dubbo.protocols.protocol1.name=dubbo",
-                "dubbo.protocols.protocol1.port=20880",
-                "dubbo.monitors.monitor1.address=zookeeper://127.0.0.1:32770",
+                "dubbo.protocols.protocol1.pORt=20880",
+                "dubbo.monitors.monitor1.Address=zookeeper://127.0.0.1:32770",
                 "dubbo.providers.provider1.host=127.0.0.1",
                 "dubbo.consumers.consumer1.client=netty",
                 "dubbo.config.multiple=true",
@@ -142,82 +142,22 @@ public class DubboAutoConfigurationOnMultipleConfigTest {
     @Autowired
     private Map<String, ConsumerConfig> consumers = new LinkedHashMap<>();
 
-    @Autowired
-    private DubboScanProperties dubboScanProperties;
-
-    @Autowired
-    private DubboConfigProperties dubboConfigProperties;
-
-    @Autowired
-    private MultipleDubboConfigBindingProperties 
multipleDubboConfigBindingProperties;
-
-    @Test
-    public void testDubboScanProperties() {
-
-        Assert.assertFalse(dubboScanProperties.getBasePackages().isEmpty());
-
-    }
-
-    @Test
-    public void testDubboConfigProperties() {
-
-        Assert.assertTrue(dubboConfigProperties.isMultiple());
-
-    }
-
     @Test
     public void testMultipleDubboConfigBindingProperties() {
 
-        /**
-         * Multiple {@link ApplicationConfig}
-         */
-        Map<String, ApplicationConfig> applications = 
multipleDubboConfigBindingProperties.getApplications();
-
-        Assert.assertEquals(2, applications.size());
 
-        applications = multipleDubboConfigBindingProperties.getApplications();
         Assert.assertEquals(2, applications.size());
 
-        /**
-         * Multiple {@link ModuleConfig}
-         */
-        Map<String, ModuleConfig> modules = 
multipleDubboConfigBindingProperties.getModules();
-
         Assert.assertEquals(1, modules.size());
 
-        /**
-         * Multiple {@link RegistryConfig}
-         */
-        Map<String, RegistryConfig> registries = 
multipleDubboConfigBindingProperties.getRegistries();
-
         Assert.assertEquals(1, registries.size());
 
-        /**
-         * Multiple {@link ProtocolConfig}
-         */
-        Map<String, ProtocolConfig> protocols = 
multipleDubboConfigBindingProperties.getProtocols();
-
         Assert.assertEquals(1, protocols.size());
 
-        /**
-         * Multiple {@link MonitorConfig}
-         */
-        Map<String, MonitorConfig> monitors = 
multipleDubboConfigBindingProperties.getMonitors();
-
         Assert.assertEquals(1, monitors.size());
 
-        /**
-         * Multiple {@link ProviderConfig}
-         */
-        Map<String, ProviderConfig> providers = 
multipleDubboConfigBindingProperties.getProviders();
-
         Assert.assertEquals(1, providers.size());
 
-        /**
-         * Multiple {@link ConsumerConfig}
-         */
-        Map<String, ConsumerConfig> consumers = 
multipleDubboConfigBindingProperties.getConsumers();
-
         Assert.assertEquals(1, consumers.size());
 
     }
@@ -232,9 +172,6 @@ public class DubboAutoConfigurationOnMultipleConfigTest {
 
         Assert.assertEquals(2, applications.size());
 
-        applications = multipleDubboConfigBindingProperties.getApplications();
-        Assert.assertEquals(2, applications.size());
-
         /**
          * Multiple {@link ModuleConfig}
          */
diff --git 
a/dubbo-spring-boot-autoconfigure/src/test/java/com/alibaba/boot/dubbo/autoconfigure/DubboAutoConfigurationOnSingleConfigTest.java
 
b/dubbo-spring-boot-autoconfigure/src/test/java/com/alibaba/boot/dubbo/autoconfigure/DubboAutoConfigurationOnSingleConfigTest.java
index 4b5efc9..c8092d3 100644
--- 
a/dubbo-spring-boot-autoconfigure/src/test/java/com/alibaba/boot/dubbo/autoconfigure/DubboAutoConfigurationOnSingleConfigTest.java
+++ 
b/dubbo-spring-boot-autoconfigure/src/test/java/com/alibaba/boot/dubbo/autoconfigure/DubboAutoConfigurationOnSingleConfigTest.java
@@ -92,43 +92,6 @@ public class DubboAutoConfigurationOnSingleConfigTest {
     @Autowired
     private ReferenceAnnotationBeanPostProcessor 
referenceAnnotationBeanPostProcessor;
 
-    @Autowired
-    private DubboScanProperties dubboScanProperties;
-
-    @Autowired
-    private DubboConfigProperties dubboConfigProperties;
-
-    @Autowired
-    private SingleDubboConfigBindingProperties 
singleDubboConfigBindingProperties;
-
-
-    @Test
-    public void testDubboScanProperties() {
-
-        Assert.assertTrue(dubboScanProperties.getBasePackages().isEmpty());
-
-    }
-
-    @Test
-    public void testDubboConfigProperties() {
-
-        Assert.assertFalse(dubboConfigProperties.isMultiple());
-
-    }
-
-    @Test
-    public void testSingleDubboConfigBindingProperties() {
-
-        
Assert.assertNotNull(singleDubboConfigBindingProperties.getApplication());
-        Assert.assertNotNull(singleDubboConfigBindingProperties.getConsumer());
-        Assert.assertNotNull(singleDubboConfigBindingProperties.getModule());
-        Assert.assertNotNull(singleDubboConfigBindingProperties.getMonitor());
-        Assert.assertNotNull(singleDubboConfigBindingProperties.getProtocol());
-        Assert.assertNotNull(singleDubboConfigBindingProperties.getProvider());
-        Assert.assertNotNull(singleDubboConfigBindingProperties.getRegistry());
-
-    }
-
     @Test
     public void testApplicationConfig() {
 
diff --git 
a/dubbo-spring-boot-autoconfigure/src/test/java/com/alibaba/boot/dubbo/autoconfigure/RelaxedDubboConfigBinderTest.java
 
b/dubbo-spring-boot-autoconfigure/src/test/java/com/alibaba/boot/dubbo/autoconfigure/RelaxedDubboConfigBinderTest.java
new file mode 100644
index 0000000..8e08086
--- /dev/null
+++ 
b/dubbo-spring-boot-autoconfigure/src/test/java/com/alibaba/boot/dubbo/autoconfigure/RelaxedDubboConfigBinderTest.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alibaba.boot.dubbo.autoconfigure;
+
+import com.alibaba.dubbo.config.ApplicationConfig;
+import com.alibaba.dubbo.config.ProtocolConfig;
+import com.alibaba.dubbo.config.RegistryConfig;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+/**
+ * {@link RelaxedDubboConfigBinder} Test
+ *
+ * @author <a href="mailto:mercybl...@gmail.com";>Mercy</a>
+ * @since 0.1.1
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@TestPropertySource(locations = "classpath:/dubbo.properties")
+@ContextConfiguration(classes = RelaxedDubboConfigBinder.class)
+public class RelaxedDubboConfigBinderTest {
+
+    @Autowired
+    private RelaxedDubboConfigBinder dubboConfigBinder;
+
+    @Test
+    public void testBinder() {
+
+        ApplicationConfig applicationConfig = new ApplicationConfig();
+        dubboConfigBinder.bind("dubbo.application", applicationConfig);
+        Assert.assertEquals("hello", applicationConfig.getName());
+        Assert.assertEquals("world", applicationConfig.getOwner());
+
+        RegistryConfig registryConfig = new RegistryConfig();
+        dubboConfigBinder.bind("dubbo.registry", registryConfig);
+        Assert.assertEquals("10.20.153.17", registryConfig.getAddress());
+
+        ProtocolConfig protocolConfig = new ProtocolConfig();
+        dubboConfigBinder.bind("dubbo.protocol", protocolConfig);
+        Assert.assertEquals(Integer.valueOf(20881), protocolConfig.getPort());
+
+    }
+}

-- 
To stop receiving notification emails like this one, please contact
mercybl...@apache.org.

Reply via email to