Skip to content
Permalink
Browse files
Fix circular reference (#823)
  • Loading branch information
haoyann committed Sep 15, 2021
1 parent cc5e780 commit d0687bba3179fb1202ec7e0adb117221bbba134b
Showing 2 changed files with 4 additions and 7 deletions.
@@ -22,10 +22,12 @@
import org.apache.dubbo.admin.common.exception.ConfigurationException;
import org.apache.dubbo.admin.common.util.Constants;
import org.apache.dubbo.admin.registry.config.GovernanceConfiguration;
import org.apache.dubbo.admin.registry.mapping.AdminMappingListener;
import org.apache.dubbo.admin.registry.mapping.ServiceMapping;
import org.apache.dubbo.admin.registry.mapping.impl.NoOpServiceMapping;
import org.apache.dubbo.admin.registry.metadata.MetaDataCollector;
import org.apache.dubbo.admin.registry.metadata.impl.NoOpMetadataCollector;
import org.apache.dubbo.admin.service.impl.InstanceRegistryCache;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.config.Environment;
import org.apache.dubbo.common.extension.ExtensionLoader;
@@ -39,7 +41,6 @@
import org.apache.dubbo.registry.client.ServiceDiscoveryFactory;
import org.apache.dubbo.rpc.model.ApplicationModel;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -100,9 +101,6 @@ public class ConfigCenter {
private URL registryUrl;
private URL metadataUrl;

@Autowired
private MappingListener mappingListener;

/*
* generate dynamic configuration client
*/
@@ -226,11 +224,12 @@ ServiceDiscovery getServiceDiscoveryRegistry() throws Exception {

@Bean
@DependsOn("metaDataCollector")
ServiceMapping getServiceMapping() {
ServiceMapping getServiceMapping(ServiceDiscovery serviceDiscovery, InstanceRegistryCache instanceRegistryCache) {
ServiceMapping serviceMapping = new NoOpServiceMapping();
if (metadataUrl == null) {
return serviceMapping;
}
MappingListener mappingListener = new AdminMappingListener(serviceDiscovery, instanceRegistryCache);
serviceMapping = ExtensionLoader.getExtensionLoader(ServiceMapping.class).getExtension(metadataUrl.getProtocol());
serviceMapping.addMappingListener(mappingListener);
serviceMapping.init(metadataUrl);
@@ -31,7 +31,6 @@
import org.apache.dubbo.registry.client.event.listener.ServiceInstancesChangedListener;

import com.google.common.collect.Sets;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;
@@ -40,7 +39,6 @@
import java.util.concurrent.ConcurrentMap;
import java.util.stream.Collectors;

@Component
public class AdminMappingListener implements MappingListener {

private static final URL CONSUMER_URL = new URL(Constants.ADMIN_PROTOCOL, NetUtils.getLocalHost(), 0, "",

0 comments on commit d0687bb

Please sign in to comment.