Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #821]Fix circular reference #823

Merged
merged 1 commit into from
Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -100,9 +101,6 @@ public class ConfigCenter {
private URL registryUrl;
private URL metadataUrl;

@Autowired
private MappingListener mappingListener;

/*
* generate dynamic configuration client
*/
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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, "",
Expand Down