Skip to content

Commit

Permalink
Fix multi protocol does not work when referencing in ProviderConfig (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
chickenlj committed Dec 19, 2019
1 parent 4848762 commit 7e4b2f3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
Expand Up @@ -136,6 +136,9 @@ public void completeCompoundConfigs() {
if (monitor == null) {
setMonitor(consumer.getMonitor());
}
if (StringUtils.isEmpty(registryIds)) {
setRegistryIds(consumer.getRegistryIds());
}
}
if (module != null) {
if (registries == null) {
Expand Down
Expand Up @@ -217,6 +217,12 @@ public void completeCompoundConfigs() {
if (configCenter == null) {
setConfigCenter(provider.getConfigCenter());
}
if (StringUtils.isEmpty(registryIds)) {
setRegistryIds(provider.getRegistryIds());
}
if (StringUtils.isEmpty(protocolIds)) {
setProtocolIds(provider.getProtocolIds());
}
}
if (module != null) {
if (registries == null) {
Expand Down
Expand Up @@ -207,7 +207,7 @@ public synchronized void export() {
}

private void checkAndUpdateSubConfigs() {
// Use default configs defined explicitly on global scope
// Use default configs defined explicitly with global scope
completeCompoundConfigs();
checkDefault();
checkProtocol();
Expand Down
Expand Up @@ -20,6 +20,7 @@
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.common.utils.ReflectUtils;
import org.apache.dubbo.common.utils.StringUtils;
import org.apache.dubbo.config.AbstractServiceConfig;
import org.apache.dubbo.config.ArgumentConfig;
import org.apache.dubbo.config.ConsumerConfig;
import org.apache.dubbo.config.MethodConfig;
Expand Down Expand Up @@ -176,7 +177,7 @@ private static BeanDefinition parse(Element element, ParserContext parserContext
RegistryConfig registryConfig = new RegistryConfig();
registryConfig.setAddress(RegistryConfig.NO_AVAILABLE);
beanDefinition.getPropertyValues().addPropertyValue(beanProperty, registryConfig);
} else if ("provider".equals(property) || "registry".equals(property) || ("protocol".equals(property) && ServiceBean.class.equals(beanClass))) {
} else if ("provider".equals(property) || "registry".equals(property) || ("protocol".equals(property) && AbstractServiceConfig.class.isAssignableFrom(beanClass))) {
/**
* For 'provider' 'protocol' 'registry', keep literal value (should be id/name) and set the value to 'registryIds' 'providerIds' protocolIds'
* The following process should make sure each id refers to the corresponding instance, here's how to find the instance for different use cases:
Expand Down

0 comments on commit 7e4b2f3

Please sign in to comment.