當前位置: 首頁>>代碼示例>>Java>>正文


Java ConfigurationManager.install方法代碼示例

本文整理匯總了Java中com.netflix.config.ConfigurationManager.install方法的典型用法代碼示例。如果您正苦於以下問題:Java ConfigurationManager.install方法的具體用法?Java ConfigurationManager.install怎麽用?Java ConfigurationManager.install使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.netflix.config.ConfigurationManager的用法示例。


在下文中一共展示了ConfigurationManager.install方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createConfig

import com.netflix.config.ConfigurationManager; //導入方法依賴的package包/類
@Override
public Config createConfig(String name) {
  if (CONFIG != null) {
    return CONFIG;
  }
  synchronized (ArchaiusBaseFactory.class) {
    if (CONFIG == null) {
      AbstractConfiguration configuration = getConfiguration();
      ConfigurationManager.install(configuration);
      CONFIG = new ArchaiusWrapper(configuration);
      ConfigFactory.setContext(CONFIG);
      configuration.addConfigurationListener(event -> {
        if (!event.isBeforeUpdate()) {
          CONFIG.fire(event.getPropertyName());
        }
      });
    }
  }
  return CONFIG;
}
 
開發者ID:irenical,項目名稱:jindy,代碼行數:21,代碼來源:ArchaiusBaseFactory.java

示例2: ArchaiusInitializingBeanPostProcessor

import com.netflix.config.ConfigurationManager; //導入方法依賴的package包/類
public ArchaiusInitializingBeanPostProcessor(ConfigurableApplicationContext applicationContext, AbstractPollingScheduler pollingScheduler, SpringEnvironmentPolledConfigurationSource polledConfigurationSource, List<ClasspathPropertySource> propertyBindings) {
  this.applicationContext = Objects.requireNonNull(applicationContext, "applicationContext");
  this.pollingScheduler = Objects.requireNonNull(pollingScheduler, "pollingScheduler");
  this.polledConfigurationSource = Objects.requireNonNull(polledConfigurationSource, "polledConfigurationSource");
  this.propertyBindings = propertyBindings != null ? propertyBindings : Collections.emptyList();
  initPropertyBindings();

  configurationInstance = new DynamicConfiguration(polledConfigurationSource, pollingScheduler);
  if (!ConfigurationManager.isConfigurationInstalled()) {
    ConfigurationManager.install(new CompositeConfiguration());
  }
  CompositeConfiguration config = (CompositeConfiguration) ConfigurationManager.getConfigInstance();
  config.addConfiguration(configurationInstance);

  applicationContext.getBeanFactory().registerSingleton("environmentBackedConfig", ConfigurationManager.getConfigInstance());
  applicationContext.getBeanFactory().registerAlias("environmentBackedConfig", "abstractConfiguration");
}
 
開發者ID:spinnaker,項目名稱:kork,代碼行數:18,代碼來源:ArchaiusConfiguration.java

示例3: addArchaiusConfiguration

import com.netflix.config.ConfigurationManager; //導入方法依賴的package包/類
private static void addArchaiusConfiguration(ConcurrentCompositeConfiguration config) {
	if (ConfigurationManager.isConfigurationInstalled()) {
		AbstractConfiguration installedConfiguration = ConfigurationManager
				.getConfigInstance();
		if (installedConfiguration instanceof ConcurrentCompositeConfiguration) {
			ConcurrentCompositeConfiguration configInstance = (ConcurrentCompositeConfiguration) installedConfiguration;
			configInstance.addConfiguration(config);
		}
		else {
			installedConfiguration.append(config);
			if (!(installedConfiguration instanceof AggregatedConfiguration)) {
				log.warn(
						"Appending a configuration to an existing non-aggregated installed configuration will have no effect");
			}
		}
	}
	else {
		ConfigurationManager.install(config);
	}
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-netflix,代碼行數:21,代碼來源:ArchaiusAutoConfiguration.java

示例4: installDynamicConfig

import com.netflix.config.ConfigurationManager; //導入方法依賴的package包/類
public static void installDynamicConfig() {
  if (ConfigurationManager.isConfigurationInstalled()) {
    LOGGER.warn("Configuration installed by others, will ignore this configuration.");
    return;
  }

  AbstractConfiguration dynamicConfig = ConfigUtil.createDynamicConfig();
  ConfigurationManager.install(dynamicConfig);
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:10,代碼來源:ConfigUtil.java

示例5: testCreateMicroserviceInstanceFromFile

import com.netflix.config.ConfigurationManager; //導入方法依賴的package包/類
@Test
public void testCreateMicroserviceInstanceFromFile() {
  AbstractConfiguration config = ConfigUtil.createDynamicConfig();
  ConcurrentCompositeConfiguration configuration = new ConcurrentCompositeConfiguration();
  configuration.addConfiguration(config);
  ConfigurationManager.install(configuration);
  MicroserviceInstance instance = MicroserviceInstance.createFromDefinition(config);
  Assert.assertEquals(instance.getDataCenterInfo().getName(), "myDC");
  Assert.assertEquals(instance.getDataCenterInfo().getRegion(), "my-Region");
  Assert.assertEquals(instance.getDataCenterInfo().getAvailableZone(), "my-Zone");
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:12,代碼來源:TestMicroServiceInstance.java

示例6: initSetup

import com.netflix.config.ConfigurationManager; //導入方法依賴的package包/類
@BeforeClass
public static void initSetup() throws Exception {
  AbstractConfiguration dynamicConfig = ConfigUtil.createDynamicConfig();
  ConcurrentCompositeConfiguration configuration = new ConcurrentCompositeConfiguration();
  configuration.addConfiguration(dynamicConfig);
  configuration.addConfiguration(inMemoryConfig);

  ConfigurationManager.install(configuration);
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:10,代碼來源:TestRegistry.java

示例7: installZkConfig

import com.netflix.config.ConfigurationManager; //導入方法依賴的package包/類
@PostConstruct
public void installZkConfig() throws Exception {
    String zkConfigRootPath = "/config/"+appName;
    ZooKeeperConfigurationSource zkConfigSource = new ZooKeeperConfigurationSource(client, zkConfigRootPath);
    zkConfigSource.start();
    DynamicWatchedConfiguration zkDynamicConfig = new DynamicWatchedConfiguration(zkConfigSource);
    ConfigurationManager.install(zkDynamicConfig);
}
 
開發者ID:IBYoung,項目名稱:vert.3x-gateway,代碼行數:9,代碼來源:ArchaiusZkConfig.java

示例8: locate

import com.netflix.config.ConfigurationManager; //導入方法依賴的package包/類
@Override
	public PropertySource<?> locate(Environment environment) {
		
		try {
			// configuration from local properties file
			ConcurrentMapConfiguration configFromPropertiesFile = new ConcurrentMapConfiguration(new PropertiesConfiguration("application.yml"));
			
			// configuration from system properties
			ConcurrentMapConfiguration configFromSystemProperties = new ConcurrentMapConfiguration(new SystemConfiguration());
			
			// configuration from a dynamic source
//			PolledConfigurationSource source = new NetflixUrlPolledConfigurationSource();
			PolledConfigurationSource source = new NetflixEurekaPolledConfigurationSource();
			AbstractPollingScheduler scheduler = new FixedDelayPollingScheduler();
			DynamicConfiguration dynamicConfiguration = new DynamicConfiguration(source, scheduler);
			
			// create a hierarchy of configuration that makes
			// 1) dynamic configuration source override system properties
			// 2) system properties override properties file
			ConcurrentCompositeConfiguration finalConfig = new ConcurrentCompositeConfiguration();
			finalConfig.addConfiguration(dynamicConfiguration, "dynamicConfig");
			finalConfig.addConfiguration(configFromSystemProperties, "systemConfig");
			finalConfig.addConfiguration(configFromPropertiesFile, "fileConfig");
			
			// install with ConfigurationManager so that finalConfig
			// becomes the source of dynamic properties
			ConfigurationManager.install(finalConfig);
		} catch(Exception e) {
			logger.error(e.getMessage());
		}
		
		return null;
	}
 
開發者ID:colddew,項目名稱:micro-service-netflix,代碼行數:34,代碼來源:NetflixPropertySourceLocator.java

示例9: configureArchaius

import com.netflix.config.ConfigurationManager; //導入方法依賴的package包/類
private void configureArchaius(ConcurrentCompositeConfiguration finalConfiguration) {
    if (configureArchaius) {
        Properties systemProps = System.getProperties();
        if (systemProps.getProperty(ARCHAIUS_DEPLOYMENT_ENVIRONMENT) == null) {
            systemProps.setProperty(ARCHAIUS_DEPLOYMENT_ENVIRONMENT, appEnvironment);
        }
        ConfigurationManager.install(finalConfiguration);
    }
}
 
開發者ID:Kixeye,項目名稱:chassis,代碼行數:10,代碼來源:ConfigurationBuilder.java

示例10: start

import com.netflix.config.ConfigurationManager; //導入方法依賴的package包/類
@Override
public void start(BundleContext context) throws Exception {
	LOGGER.entering(CLASSNAME, "start", context);
	this.bContext = context;
	context.registerService(ManagedService.class, this, getDefaults())
			.getReference();
	ConcurrentCompositeConfiguration finalConfig = new ConcurrentCompositeConfiguration();
	finalConfig.addConfiguration(configuration);
	ConfigurationManager.install(finalConfig);
	LOGGER.exiting(CLASSNAME, "start");
}
 
開發者ID:WASdev,項目名稱:sample.netflixoss.wlp,代碼行數:12,代碼來源:Activator.java

示例11: DynamicPropertiesImpl

import com.netflix.config.ConfigurationManager; //導入方法依賴的package包/類
DynamicPropertiesImpl(AbstractConfiguration... configurations) {
  ConcurrentCompositeConfiguration configuration = new ConcurrentCompositeConfiguration();
  Arrays.stream(configurations).forEach(configuration::addConfiguration);

  ConfigurationManager.install(configuration);
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:7,代碼來源:DynamicPropertiesImpl.java


注:本文中的com.netflix.config.ConfigurationManager.install方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。