源码角度
详情请看ReferenceConfig createProxy的 第359行
urls.clear(); // reference retry init will add url to urls, lead to OOM
if (url != null && url.length() > 0) { // user specified URL, could be peer-to-peer address, or register center's address.
String[] us = SEMICOLON_SPLIT_PATTERN.split(url);
if (us != null && us.length > 0) {
for (String u : us) {
URL url = URL.valueOf(u);
if (StringUtils.isEmpty(url.getPath())) {
url = url.setPath(interfaceName);
}
if (REGISTRY_PROTOCOL.equals(url.getProtocol())) {
urls.add(url.addParameterAndEncoded(REFER_KEY, StringUtils.toQueryString(map)));
} else {
urls.add(ClusterUtils.mergeUrl(url, map));
}
}
}
}
这里是判断 Reference 是否配置 url 如果配置则为直连方式 ClusterUtils.mergeUrl(url, map) 中第87行删除了版本号 所以dubbo获取到默认版本号0.0.0,所以 这里直连的服务提供方提供的其他版本号将不能提供服务。