@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()); ConsumerConfig consumerConfig = new ConsumerConfig(); dubboConfigBinder.bind("dubbo.consumer", consumerConfig); Assert.assertEquals(isDefault, consumerConfig.isDefault()); Assert.assertEquals(client, consumerConfig.getClient()); Assert.assertEquals(threadPool, consumerConfig.getThreadpool()); Assert.assertEquals(coreThreads, consumerConfig.getCorethreads()); Assert.assertEquals(threads, consumerConfig.getThreads()); Assert.assertEquals(queues, consumerConfig.getQueues()); }
@Override public <C extends AbstractConfig> void bind(String prefix, C dubboConfig) { DataBinder dataBinder = new DataBinder(dubboConfig); dataBinder.setIgnoreInvalidFields(isIgnoreInvalidFields()); dataBinder.setIgnoreUnknownFields(isIgnoreUnknownFields()); Map<String, Object> properties = getSubProperties(getPropertySources(), prefix); MutablePropertyValues propertyValues = new MutablePropertyValues(properties); dataBinder.bind(propertyValues); }
DefaultDubboConfigBinder extends AbstractDubboConfigBinder { @Override public <C extends AbstractConfig> void bind(String prefix, C dubboConfig) { DataBinder dataBinder = new DataBinder(dubboConfig); dataBinder.setIgnoreInvalidFields(isIgnoreInvalidFields()); dataBinder.setIgnoreUnknownFields(isIgnoreUnknownFields()); Map<String, Object> properties = getSubProperties(getPropertySources(), prefix); MutablePropertyValues propertyValues = new MutablePropertyValues(properties); dataBinder.bind(propertyValues); } }
DefaultDubboConfigBinder extends AbstractDubboConfigBinder { @Override public <C extends AbstractConfig> void bind(String prefix, C dubboConfig) { DataBinder dataBinder = new DataBinder(dubboConfig); dataBinder.setIgnoreInvalidFields(isIgnoreInvalidFields()); dataBinder.setIgnoreUnknownFields(isIgnoreUnknownFields()); Map<String, Object> properties = getSubProperties(getPropertySources(), prefix); MutablePropertyValues propertyValues = new MutablePropertyValues(properties); dataBinder.bind(propertyValues); }  }
DefaultDubboConfigBinder extends AbstractDubboConfigBinder { @Override public <C extends AbstractConfig> void bind(String prefix, C dubboConfig) { DataBinder dataBinder = new DataBinder(dubboConfig); dataBinder.setIgnoreInvalidFields(isIgnoreInvalidFields()); dataBinder.setIgnoreUnknownFields(isIgnoreUnknownFields()); Map<String, Object> properties = getSubProperties(getPropertySources(), prefix); MutablePropertyValues propertyValues = new MutablePropertyValues(properties); dataBinder.bind(propertyValues); }  @Override void bind(String prefix, C dubboConfig); }
DefaultDubboConfigBinder extends AbstractDubboConfigBinder { @Override public <C extends AbstractConfig> void bind(String prefix, C dubboConfig) { DataBinder dataBinder = new DataBinder(dubboConfig); dataBinder.setIgnoreInvalidFields(isIgnoreInvalidFields()); dataBinder.setIgnoreUnknownFields(isIgnoreUnknownFields()); Map<String, Object> properties = getSubProperties(getPropertySources(), prefix); MutablePropertyValues propertyValues = new MutablePropertyValues(properties); dataBinder.bind(propertyValues); }  @Override void bind(String prefix, C dubboConfig);  }