本文整理汇总了Java中com.typesafe.config.ConfigFactory.parseResources方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigFactory.parseResources方法的具体用法?Java ConfigFactory.parseResources怎么用?Java ConfigFactory.parseResources使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.typesafe.config.ConfigFactory
的用法示例。
在下文中一共展示了ConfigFactory.parseResources方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getParamReader
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static ParamReader getParamReader() {
String dbCredsFile = System.getProperty("dbCredsFile");
if (StringUtils.isEmpty(dbCredsFile)) {
dbCredsFile = "postgresql-creds.properties";
}
return new ParamReader(
ConfigFactory.parseResources(dbCredsFile),
"postgresql",
ConfigFactory.parseMap(Maps.mutable.<String, Object>of(
"sysattrs.type", "POSTGRESQL",
"logicalSchemas.schema1", "schema1",
"logicalSchemas.schema2", "schema2"
))
);
}
示例2: XConfig
import com.typesafe.config.ConfigFactory; //导入方法依赖的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"));
}
示例3: buildConfigIfAbsent
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
private Config buildConfigIfAbsent(Config currentConfig) {
if (currentConfig != null) return currentConfig;
if (getClass().getClassLoader().getResource(resourcePath) != null) {
return ConfigFactory.parseResources(resourcePath);
}
logger.debug("Missing configuration resource at path: {}, ignore flag set to: {}", resourcePath, ignoreMissingResource);
if (ignoreMissingResource) {
return ConfigFactory.empty();
}
throw new IllegalStateException("Missing required configuration resource at path: " + resourcePath);
}
示例4: getParamReader
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static ParamReader getParamReader() {
String dbCredsFile = System.getProperty("dbCredsFile");
if (StringUtils.isEmpty(dbCredsFile)) {
dbCredsFile = "mssql-creds.properties";
}
return new ParamReader(ConfigFactory.parseResources(dbCredsFile),
"mssql", ConfigFactory.parseMap(Maps.mutable.<String, Object>of(
"sysattrs.type", "MSSQL",
"logicalSchemas.schema1", "oats"
))
);
}
示例5: getParamReader
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static ParamReader getParamReader() {
return new ParamReader(ConfigFactory.parseResources("db2-creds.properties"), "db2", ConfigFactory.parseMap(Maps.mutable.<String, Object>of(
"sysattrs.type", "DB2",
"sysattrs.autoReorgEnabled", "true",
"sysattrs.metadataLineReaderVersion", "3",
"logicalSchemas.schema1", "DEPLOY_TRACKER"
)));
}
示例6: getParamReader
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static ParamReader getParamReader() {
String dbCredsFile = System.getProperty("dbCredsFile");
if (StringUtils.isEmpty(dbCredsFile)) {
dbCredsFile = "oracle-creds.properties";
}
return new ParamReader(ConfigFactory.parseResources(dbCredsFile),
"oracle", ConfigFactory.parseMap(Maps.mutable.<String, Object>of(
"sysattrs.type", "ORACLE",
"logicalSchemas.schema1", "schema1",
"logicalSchemas.schema2", "schema2"
))
);
}
示例7: getParamReader
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static ParamReader getParamReader() {
String dbCredsFile = System.getProperty("dbCredsFile");
if (StringUtils.isEmpty(dbCredsFile)) {
dbCredsFile = "sybasease-creds.properties";
}
return new ParamReader(ConfigFactory.parseResources(dbCredsFile),
"sybasease", ConfigFactory.parseMap(Maps.mutable.<String, Object>of(
"sysattrs.type", "SYBASE_ASE",
"logicalSchemas.schema1", "oats"
))
);
}
示例8: getParamReader
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static ParamReader getParamReader() {
return new ParamReader(ConfigFactory.parseResources("h2-creds.properties"),
"h2", ConfigFactory.parseMap(Maps.mutable.<String, Object>of(
"sysattrs.type", "H2",
"logicalSchemas.schema1", "SCHEMA1",
"logicalSchemas.schema2", "SCHEMA2"
))
);
}
示例9: getParamReader
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static ParamReader getParamReader() {
return new ParamReader(ConfigFactory.parseResources("sybaseiq-creds.properties"),
"sybaseiq", ConfigFactory.parseMap(Maps.mutable.<String, Object>of(
"sysattrs.type", "SYBASE_IQ",
"logicalSchemas.schema1", "deploytest01"
))
);
}
示例10: getParamReader
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static ParamReader getParamReader() {
return new ParamReader(ConfigFactory.parseResources("hsql-creds.properties"),
"hsql", ConfigFactory.parseMap(Maps.mutable.<String, Object>of(
"sysattrs.type", "HSQL",
"logicalSchemas.schema1", "SCHEMA1",
"logicalSchemas.schema2", "SCHEMA2"
))
);
}
示例11: SystemProperties
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public SystemProperties(String configResource) {
this(ConfigFactory.parseResources(configResource));
}
示例12: main
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static void main(String[] args) {
// {{start:resource}}
Config defaultConfig = ConfigFactory.parseResources("defaults.conf");
// {{end:resource}}
// {{start:fallback}}
Config fallbackConfig = ConfigFactory.parseResources("overrides.conf")
.withFallback(defaultConfig)
.resolve();
// {{end:fallback}}
// {{start:text}}
log.info("name: {}", defaultConfig.getString("conf.name"));
log.info("name: {}", fallbackConfig.getString("conf.name"));
log.info("title: {}", defaultConfig.getString("conf.title"));
log.info("title: {}", fallbackConfig.getString("conf.title"));
// {{end:text}}
// {{start:resolved}}
log.info("combined: {}", fallbackConfig.getString("conf.combined"));
// {{end:resolved}}
// {{start:durations}}
log.info("redis.ttl minutes: {}", fallbackConfig.getDuration("redis.ttl", TimeUnit.MINUTES));
log.info("redis.ttl seconds: {}", fallbackConfig.getDuration("redis.ttl", TimeUnit.SECONDS));
// {{end:durations}}
// {{start:memorySize}}
// Any path in the configuration can be treated as a separate Config object.
Config uploadService = fallbackConfig.getConfig("uploadService");
log.info("maxChunkSize bytes: {}", uploadService.getMemorySize("maxChunkSize").toBytes());
log.info("maxFileSize bytes: {}", uploadService.getMemorySize("maxFileSize").toBytes());
// {{end:memorySize}}
// {{start:whitelist}}
List<Integer> whiteList = fallbackConfig.getIntList("conf.nested.whitelistIds");
log.info("whitelist: {}", whiteList);
List<String> whiteListStrings = fallbackConfig.getStringList("conf.nested.whitelistIds");
log.info("whitelist as Strings: {}", whiteListStrings);
// {{end:whitelist}}
// {{start:booleans}}
log.info("yes: {}", fallbackConfig.getBoolean("featureFlags.featureA"));
log.info("true: {}", fallbackConfig.getBoolean("featureFlags.featureB"));
// {{end:booleans}}
}
示例13: read
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
@Override
public Config read() {
return ConfigFactory.parseResources("application.conf");
}