Browse Source

Don't use deprecated constructor.

Eliminates a legacy use of a static singleton. This will help allow multiple registrations.
pull/6/head
Spencer Gibb 9 years ago
parent
commit
856c47138a
No known key found for this signature in database
GPG Key ID: 7788A47380690861
  1. 6
      spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/EurekaRibbonClientConfiguration.java
  2. 6
      spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/ribbon/eureka/RibbonClientPreprocessorIntegrationTests.java

6
spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/EurekaRibbonClientConfiguration.java

@ -17,7 +17,9 @@ @@ -17,7 +17,9 @@
package org.springframework.cloud.netflix.ribbon.eureka;
import javax.annotation.PostConstruct;
import javax.inject.Provider;
import com.netflix.discovery.EurekaClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@ -89,9 +91,9 @@ public class EurekaRibbonClientConfiguration { @@ -89,9 +91,9 @@ public class EurekaRibbonClientConfiguration {
@Bean
@ConditionalOnMissingBean
public ServerList<?> ribbonServerList(IClientConfig config) {
public ServerList<?> ribbonServerList(IClientConfig config, Provider<EurekaClient> eurekaClientProvider) {
DiscoveryEnabledNIWSServerList discoveryServerList = new DiscoveryEnabledNIWSServerList(
config);
config, eurekaClientProvider);
DomainExtractingServerList serverList = new DomainExtractingServerList(
discoveryServerList, config, this.approximateZoneFromHostname);
return serverList;

6
spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/ribbon/eureka/RibbonClientPreprocessorIntegrationTests.java

@ -16,8 +16,10 @@ @@ -16,8 +16,10 @@
package org.springframework.cloud.netflix.ribbon.eureka;
import com.netflix.discovery.EurekaClient;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.test.SpringApplicationConfiguration;
@ -92,6 +94,10 @@ public class RibbonClientPreprocessorIntegrationTests { @@ -92,6 +94,10 @@ public class RibbonClientPreprocessorIntegrationTests {
ArchaiusAutoConfiguration.class, RibbonAutoConfiguration.class,
RibbonEurekaAutoConfiguration.class })
protected static class TestConfiguration {
@Bean
EurekaClient eurekaClient() {
return Mockito.mock(EurekaClient.class);
}
}
@Configuration

Loading…
Cancel
Save