From 7a9e25ce86bc94a43d9f60791ced0d49040f7ea1 Mon Sep 17 00:00:00 2001 From: Ling Yuan Date: Wed, 11 Nov 2020 10:21:53 -0800 Subject: [PATCH] Fix DiscoveryManager for DI tests --- .../CustomAmazonInfoProviderInstanceConfigFactory.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eureka-client-archaius2/src/main/java/com/netflix/appinfo/providers/CustomAmazonInfoProviderInstanceConfigFactory.java b/eureka-client-archaius2/src/main/java/com/netflix/appinfo/providers/CustomAmazonInfoProviderInstanceConfigFactory.java index 4b5dc603b..cba792572 100644 --- a/eureka-client-archaius2/src/main/java/com/netflix/appinfo/providers/CustomAmazonInfoProviderInstanceConfigFactory.java +++ b/eureka-client-archaius2/src/main/java/com/netflix/appinfo/providers/CustomAmazonInfoProviderInstanceConfigFactory.java @@ -4,6 +4,7 @@ import com.netflix.appinfo.Ec2EurekaArchaius2InstanceConfig; import com.netflix.appinfo.EurekaInstanceConfig; import com.netflix.archaius.api.Config; +import com.netflix.discovery.DiscoveryManager; import javax.inject.Inject; import javax.inject.Provider; @@ -26,6 +27,9 @@ public CustomAmazonInfoProviderInstanceConfigFactory(Config configInstance, Amaz public EurekaInstanceConfig get() { if (eurekaInstanceConfig == null) { eurekaInstanceConfig = new Ec2EurekaArchaius2InstanceConfig(configInstance, amazonInfoProvider); + + // Copied from CompositeInstanceConfigFactory.get + DiscoveryManager.getInstance().setEurekaInstanceConfig(eurekaInstanceConfig); } return eurekaInstanceConfig;