use of com.netflix.discovery.DefaultEurekaClientConfig in project eureka by Netflix.
the class DefaultEurekaClientConfigProviderTest method testNameSpaceInjection.
@Test
public void testNameSpaceInjection() throws Exception {
ConfigurationManager.getConfigInstance().setProperty("testnamespace.serviceUrl.default", SERVICE_URI);
Injector injector = LifecycleInjector.builder().withBootstrapModule(new BootstrapModule() {
@Override
public void configure(BootstrapBinder binder) {
binder.bind(String.class).annotatedWith(EurekaNamespace.class).toInstance("testnamespace.");
}
}).build().createInjector();
DefaultEurekaClientConfig clientConfig = injector.getInstance(DefaultEurekaClientConfig.class);
List<String> serviceUrls = clientConfig.getEurekaServerServiceUrls("default");
assertThat(serviceUrls.get(0), is(equalTo(SERVICE_URI)));
}
use of com.netflix.discovery.DefaultEurekaClientConfig in project eureka by Netflix.
the class ExampleEurekaClient method main.
public static void main(String[] args) {
ExampleEurekaClient sampleClient = new ExampleEurekaClient();
// create the client
ApplicationInfoManager applicationInfoManager = initializeApplicationInfoManager(new MyDataCenterInstanceConfig());
EurekaClient client = initializeEurekaClient(applicationInfoManager, new DefaultEurekaClientConfig());
// use the client
sampleClient.sendRequestToServiceUsingEureka(client);
// shutdown the client
eurekaClient.shutdown();
}
Aggregations