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


Java ConfigurationManager.loadCascadedPropertiesFromResources方法代碼示例

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


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

示例1: load

import com.netflix.config.ConfigurationManager; //導入方法依賴的package包/類
@Override
public void load() {
    String appNameToUse = appName;

    if (null == appNameToUse) {
        appNameToUse = ConfigurationManager.getDeploymentContext().getApplicationId();
    }

    try {
        logger.info(String.format("Loading application properties with app id: %s and environment: %s",
                                  appNameToUse,
                                  ConfigurationManager.getDeploymentContext().getDeploymentEnvironment()));
        /**
         * This loads a property file with the name "appName".properties and "appName"-"env".properties, if found.
         */
        ConfigurationManager.loadCascadedPropertiesFromResources(appNameToUse);
    } catch (IOException e) {
        logger.error(String.format(
                "Failed to load properties for application id: %s and environment: %s. This is ok, if you do not have application level properties.",
                appNameToUse,
                ConfigurationManager.getDeploymentContext().getDeploymentEnvironment()), e);
    }
}
 
開發者ID:Netflix,項目名稱:karyon,代碼行數:24,代碼來源:DefaultPropertiesLoader.java

示例2: contextInitialized

import com.netflix.config.ConfigurationManager; //導入方法依賴的package包/類
@Override
public void contextInitialized(ServletContextEvent sce) {
    LOGGER.info("Starting application");

    try {
        ConfigurationManager.loadCascadedPropertiesFromResources("configuration");
    } catch (IOException e) {
        LOGGER.error("Failed to load properties", e);
    }
    Log.send(LogCode.SYSTEM_STARTED, "System started");

    MetricPusher.start();

    Map<String,String> result = PassengerStopAssignmentLoader.load();
    if (result != null && result.size() > 0) {
        StopStore.setStore(result);
    }

    SubscriptionStore.start();
    AuthorizationWhitelist.start();

    OUTPUT_TRANSPORT = TransportFactory.get();
    OUTPUT_TRANSPORT.registerListener(SubscriptionHandler.listener);

    LineProvider.start();
    DestinationProvider.start();
    TimingPointProvider.start();

    RealTimeProvider.start();
    QuayDataProvider.start();
}
 
開發者ID:CROW-NDOV,項目名稱:displaydirect,代碼行數:32,代碼來源:BootListener.java

示例3: contextInitialized

import com.netflix.config.ConfigurationManager; //導入方法依賴的package包/類
@Override
public void contextInitialized(ServletContextEvent sce) {
    try {
        ConfigurationManager.loadCascadedPropertiesFromResources("configuration");
    } catch (IOException e) {
        LOGGER.error("Failed to load properties", e);
    }

    mqtt = new MqttClient(new MonitoringHandler());
}
 
開發者ID:CROW-NDOV,項目名稱:displaydirect,代碼行數:11,代碼來源:BootListener.java

示例4: contextInitialized

import com.netflix.config.ConfigurationManager; //導入方法依賴的package包/類
@Override
public void contextInitialized(ServletContextEvent sce) {

    try {
        ConfigurationManager.loadCascadedPropertiesFromResources("configuration");
    } catch (IOException e) {
        LOGGER.error("Failed to load properties", e);
    }

    LOGGER.info("Got boot initialized");
    t = new DisplayDirectClient(new Configuration());
    t.setListener(new OnDisplayDirectListener() {
        @Override
        public void onScreenContentsChange(List<PassTime> times) { }

        @Override
        public void onSubscriptionResponse(DisplayDirectMessage.SubscriptionResponse response) {
            LOGGER.info("Got subscription response {}", response.getStatus());
        }

        @Override
        public void onMessage(DisplayDirectMessage.Container value) {

        }
    });
    t.start();
}
 
開發者ID:CROW-NDOV,項目名稱:displaydirect,代碼行數:28,代碼來源:BootListener.java

示例5: infrastructureInit

import com.netflix.config.ConfigurationManager; //導入方法依賴的package包/類
/**
 * Initializes the Archaius system and configures the Netty leak detection level (if necessary).
 * DO NOT CALL THIS DIRECTLY. Use {@link #launchServer(String[])} when you're ready to start the server.
 */
protected void infrastructureInit() {
    MainClassUtils.setupJbossLoggingToUseSlf4j();

    try {
        Pair<String, String> appIdAndEnvironmentPair = MainClassUtils.getAppIdAndEnvironmentFromSystemProperties();
        ConfigurationManager.loadCascadedPropertiesFromResources(appIdAndEnvironmentPair.getLeft());
    }
    catch (IOException e) {
        throw new RuntimeException("Error loading Archaius properties", e);
    }

    AbstractConfiguration appConfig = ConfigurationManager.getConfigInstance();
    Function<String, Boolean> hasPropertyFunction = (propKey) -> appConfig.getProperty(propKey) != null;
    Function<String, String> propertyExtractionFunction = (propKey) -> {
        // Properties in Archaius might be a Collection or an Object.
        Object propValObj = appConfig.getProperty(propKey);
        return (propValObj instanceof Collection)
               ? ((Collection<?>) propValObj).stream().map(String::valueOf).collect(Collectors.joining(","))
               : String.valueOf(propValObj);
    };
    Set<String> propKeys = new LinkedHashSet<>();
    appConfig.getKeys().forEachRemaining(propKeys::add);

    MainClassUtils.logApplicationPropertiesIfDebugActionsEnabled(
        hasPropertyFunction, propertyExtractionFunction, propKeys, false
    );

    MainClassUtils.setupNettyLeakDetectionLevel(hasPropertyFunction, propertyExtractionFunction);
}
 
開發者ID:Nike-Inc,項目名稱:riposte,代碼行數:34,代碼來源:ArchaiusServer.java

示例6: initialize

import com.netflix.config.ConfigurationManager; //導入方法依賴的package包/類
@PostConstruct
public void initialize() {
    LOG.info("Initializing");
    String filename = PAAS_PROPS_FILE.get();
    try {
        ConfigurationManager.loadCascadedPropertiesFromResources(filename);
    } catch (IOException e) {
        LOG.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.",
                filename);
    }
}
 
開發者ID:Netflix,項目名稱:staash,代碼行數:13,代碼來源:ArchaeusPaasConfiguration.java

示例7: setup

import com.netflix.config.ConfigurationManager; //導入方法依賴的package包/類
@Before
public void setup() {
    try {
        ConfigurationManager.loadCascadedPropertiesFromResources("configuration");
    } catch (IOException ignored) {}
}
 
開發者ID:CROW-NDOV,項目名稱:displaydirect,代碼行數:7,代碼來源:PlanningLoaderTest.java


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