本文整理汇总了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();
}