本文整理匯總了Java中com.typesafe.config.Config.withFallback方法的典型用法代碼示例。如果您正苦於以下問題:Java Config.withFallback方法的具體用法?Java Config.withFallback怎麽用?Java Config.withFallback使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.typesafe.config.Config
的用法示例。
在下文中一共展示了Config.withFallback方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: XConfig
import com.typesafe.config.Config; //導入方法依賴的package包/類
/**
* Construct a config object using the provided configuration, falling back on the default
* configuration values <a
* href="https://github.com/Nordstrom/xrpc/blob/master/src/main/resources/com/nordstrom/xrpc/xrpc.conf">here</a>.
*/
public XConfig(Config configOverrides) {
Config defaultConfig = ConfigFactory.parseResources(this.getClass(), "xrpc.conf");
Config config = configOverrides.withFallback(defaultConfig);
readerIdleTimeout = config.getInt("reader_idle_timeout_seconds");
writerIdleTimeout = config.getInt("writer_idle_timeout_seconds");
allIdleTimeout = config.getInt("all_idle_timeout_seconds");
workerNameFormat = config.getString("worker_name_format");
bossThreadCount = config.getInt("boss_thread_count");
workerThreadCount = config.getInt("worker_thread_count");
maxConnections = config.getInt("max_connections");
rateLimiterPoolSize = config.getInt("rate_limiter_pool_size");
softReqPerSec = config.getDouble("soft_req_per_sec");
hardReqPerSec = config.getDouble("hard_req_per_sec");
gloablSoftReqPerSec = config.getDouble("global_soft_req_per_sec");
globalHardReqPerSec = config.getDouble("global_hard_req_per_sec");
cert = config.getString("cert");
key = config.getString("key");
port = config.getInt("server.port");
slf4jReporter = config.getBoolean("slf4j_reporter");
jmxReporter = config.getBoolean("jmx_reporter");
consoleReporter = config.getBoolean("console_reporter");
slf4jReporterPollingRate = config.getInt("slf4j_reporter_polling_rate");
consoleReporterPollingRate = config.getInt("console_reporter_polling_rate");
enableWhiteList = config.getBoolean("enable_white_list");
enableBlackList = config.getBoolean("enable_black_list");
ipBlackList =
ImmutableSet.<String>builder().addAll(config.getStringList("ip_black_list")).build();
ipWhiteList =
ImmutableSet.<String>builder().addAll(config.getStringList("ip_white_list")).build();
populateClientOverrideList(config.getObjectList("req_per_second_override"));
}
示例2: initActorSystem
import com.typesafe.config.Config; //導入方法依賴的package包/類
public void initActorSystem(File file, String akkaName, String configName) {
logger.debug("init Actor System start: akkaName=" + akkaName + " configName:" + configName);
Config cg = ConfigFactory.parseFile(file);
cg.withFallback(ConfigFactory.defaultReference(Thread.currentThread().getContextClassLoader()));
Config config = ConfigFactory.load(cg).getConfig(configName);
system = ActorSystem.create(akkaName, config);
inbox = Inbox.create(system);
logger.debug("init Actor System end");
}
示例3: initActorSystem
import com.typesafe.config.Config; //導入方法依賴的package包/類
public void initActorSystem(File file, String akkaName, String configName) {
logger.debug("init Actor System start: akkaName=" + akkaName + " configName:" + configName);
Config cg = ConfigFactory.parseFile(file);
cg.withFallback(ConfigFactory.defaultReference(Thread.currentThread().getContextClassLoader()));
Config config = ConfigFactory.load(cg).getConfig(configName);
system = ActorSystem.create(akkaName, config);
inbox = Inbox.create(system);
logger.debug("init Actor System end");
}
示例4: setup
import com.typesafe.config.Config; //導入方法依賴的package包/類
@BeforeClass
public static void setup() {
File file = new File("D:\\Users\\xl\\workspace\\FlayShooting\\conf\\application.conf");
Config cg = ConfigFactory.parseFile(file);
cg.withFallback(ConfigFactory.defaultReference(Thread.currentThread().getContextClassLoader()));
Config config = ConfigFactory.load(cg).getConfig("CodeBroker");
system = ActorSystem.create("CodeBroker", config);
}
示例5: merge
import com.typesafe.config.Config; //導入方法依賴的package包/類
protected Config merge() {
Config config = ConfigFactory.parseMap(configHolder);
if (fallback != null) {
config = config.withFallback(fallback);
}
return config;
}
示例6: overrideParams
import com.typesafe.config.Config; //導入方法依賴的package包/類
/**
* Puts a new config atop of existing stack making the options
* in the supplied config overriding existing options
* Once put this config can't be removed
*
* @param overrideOptions - atop config
*/
public void overrideParams(Config overrideOptions) {
config = overrideOptions.withFallback(config);
validateConfig();
}