本文整理匯總了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);
}
}
示例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();
}
示例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());
}
示例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();
}
示例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);
}
示例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);
}
}
示例7: setup
import com.netflix.config.ConfigurationManager; //導入方法依賴的package包/類
@Before
public void setup() {
try {
ConfigurationManager.loadCascadedPropertiesFromResources("configuration");
} catch (IOException ignored) {}
}