use of com.netflix.governator.guice.BootstrapBinder 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)));
}
Aggregations