use of com.netflix.config.DynamicPropertyFactory in project eureka by Netflix.
the class ExampleEurekaService method main.
public static void main(String[] args) {
DynamicPropertyFactory configInstance = com.netflix.config.DynamicPropertyFactory.getInstance();
ApplicationInfoManager applicationInfoManager = initializeApplicationInfoManager(new MyDataCenterInstanceConfig());
EurekaClient eurekaClient = initializeEurekaClient(applicationInfoManager, new DefaultEurekaClientConfig());
ExampleServiceBase exampleServiceBase = new ExampleServiceBase(applicationInfoManager, eurekaClient, configInstance);
try {
exampleServiceBase.start();
} finally {
// the stop calls shutdown on eurekaClient
exampleServiceBase.stop();
}
}
use of com.netflix.config.DynamicPropertyFactory in project eureka by Netflix.
the class Archaius1Utils method initConfig.
public static DynamicPropertyFactory initConfig(String configName) {
DynamicPropertyFactory configInstance = DynamicPropertyFactory.getInstance();
DynamicStringProperty EUREKA_PROPS_FILE = configInstance.getStringProperty("eureka.client.props", configName);
String env = ConfigurationManager.getConfigInstance().getString(EUREKA_ENVIRONMENT, "test");
ConfigurationManager.getConfigInstance().setProperty(ARCHAIUS_DEPLOYMENT_ENVIRONMENT, env);
String eurekaPropsFile = EUREKA_PROPS_FILE.get();
try {
ConfigurationManager.loadCascadedPropertiesFromResources(eurekaPropsFile);
} catch (IOException e) {
logger.warn("Cannot find the properties specified : {}. This may be okay if there are other environment " + "specific properties or the configuration is installed with a different mechanism.", eurekaPropsFile);
}
return configInstance;
}
use of com.netflix.config.DynamicPropertyFactory in project eureka by Netflix.
the class ExampleEurekaGovernatedService method init.
private static LifecycleInjector init() throws Exception {
System.out.println("Creating injector for Example Service");
LifecycleInjector injector = InjectorBuilder.fromModules(new EurekaModule(), new ExampleServiceModule()).overrideWith(new AbstractModule() {
@Override
protected void configure() {
DynamicPropertyFactory configInstance = com.netflix.config.DynamicPropertyFactory.getInstance();
bind(DynamicPropertyFactory.class).toInstance(configInstance);
// the default impl of EurekaInstanceConfig is CloudInstanceConfig, which we only want in an AWS
// environment. Here we override that by binding MyDataCenterInstanceConfig to EurekaInstanceConfig.
bind(EurekaInstanceConfig.class).to(MyDataCenterInstanceConfig.class);
// (DiscoveryClient optional bindings) bind the optional event bus
// bind(EventBus.class).to(EventBusImpl.class).in(Scopes.SINGLETON);
}
}).createInjector();
System.out.println("Done creating the injector");
return injector;
}
Aggregations