本文整理汇总了Java中com.typesafe.config.ConfigFactory.parseString方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigFactory.parseString方法的具体用法?Java ConfigFactory.parseString怎么用?Java ConfigFactory.parseString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.typesafe.config.ConfigFactory
的用法示例。
在下文中一共展示了ConfigFactory.parseString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildConfigIfAbsent
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
private Config buildConfigIfAbsent(Config currentConfig) {
if (currentConfig != null) return currentConfig;
Optional<String> configurationFile = kvClient.getValueAsString(configurationFilePath).toJavaUtil();
if (configurationFile.isPresent()) {
return ConfigFactory.parseString(configurationFile.get());
}
logger.debug("Missing configuration file at path: {}, ignore flag set to: {}", configurationFilePath, ignoreMissingResource);
if (ignoreMissingResource) {
return ConfigFactory.empty();
}
throw new IllegalStateException("Missing required configuration resource at path: " + configurationFilePath);
}
示例2: parseConfig
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
private static Config parseConfig(@NotNull final String jsonConfig) throws ValidationException {
try {
return ConfigFactory.parseString(jsonConfig, Constants.CONFIG_PARSE_OPTIONS);
} catch (ConfigException e) {
throw ValidationException.create("Configuration error", e);
}
}
示例3: parseClusterConfig
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
private static Config parseClusterConfig(@NotNull final String jsonConfig) throws ValidationException {
try {
return ConfigFactory.parseString(jsonConfig, Constants.CONFIG_PARSE_OPTIONS);
} catch (ConfigException e) {
throw ValidationException.create("Cluster configuration error for " + jsonConfig, e);
}
}
示例4: clusterConfigFor
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
@Override
public Config clusterConfigFor(@NotNull final ActorKey actorKey) {
return ConfigFactory.parseString("{\"" + ClusterClients.FACTORY_CLASS + "\":" + //
"\"" + JMSClusterClientFactory.class.getName() + "\"," + //
"\"" + ClusterClients.FACTORY_CONFIG + "\":" + //
"" + serverEndpoint.toConfig().root().render(ConfigRenderOptions.concise()) + "}");
}
示例5: factory_is_created_from_cluster_config
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
@Test
public void factory_is_created_from_cluster_config() {
Config clusterConfig = ConfigFactory.parseString("{\"" + ClusterClients.FACTORY_CLASS + "\":\"" + DummyClusterClientFactory.class.getName() + "\"," + //
"\"" + ClusterClients.FACTORY_CONFIG + "\":{}}");
AgentClusterClientFactory factory = ClusterClients.newFactory(AgentClusterClientFactory.class,
clusterConfig,
actorRegistry);
assertNotNull(factory);
assertThat(factory, instanceOf(DummyClusterClientFactory.class));
}
示例6: clusterConfigFor
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
@Override
public Config clusterConfigFor(@NotNull final ActorKey actorKey) {
return ConfigFactory.parseString("{\"" + ClusterClients.FACTORY_CLASS + "\":" + //
"\"" + JgroupsClusterClientFactory.class.getName() + "\"," + //
"\"" + ClusterClients.FACTORY_CONFIG + "\":" + //
jgroupsFactoryConfig.root().render(ConfigRenderOptions.concise()) + "}");
}
示例7: jmsClusterConfig
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
private Config jmsClusterConfig() {
return ConfigFactory.parseString("{\"" + ClusterClients.FACTORY_CLASS + "\":\"" + JMS_AGENT_FACTORY_CLASS + "\"," + //
"\"" + ClusterClients.FACTORY_CONFIG + "\":" + jmsFactoryConfigJson(
endpoint) + "}");
}
示例8: leaderJmsClusterConfig
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
private Config leaderJmsClusterConfig(final String factoryClass) {
return ConfigFactory.parseString("{\"" + ClusterClients.FACTORY_CLASS + "\":\"" + factoryClass + "\"," + //
"\"" + ClusterClients.FACTORY_CONFIG + "\":" + jmsFactoryConfigJson(
endpoint) + "}");
}
示例9: jmsClusterConfig
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
private static Config jmsClusterConfig(final JMSEndpoint endpoint) {
return ConfigFactory.parseString("{\"" + ClusterClients.FACTORY_CLASS + "\":\"" + JMSClusterClientFactory.class.getName() + "\"," + //
"\"" + ClusterClients.FACTORY_CONFIG + "\":" + jmsFactoryConfigJson(
endpoint) + "}");
}
示例10: toConfig
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public Config toConfig() {
return ConfigFactory.parseString("{\"" + AgentConfig.AGENT_CLUSTER_TAG + "\":" + clusterConfigJson() + "}");
}
示例11: TestActor
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
protected TestActor(final Sender sender) {
this(DUMMY_ACTOR, sender, ConfigFactory.parseString(DUMMY_JSON_CONFIG));
}
示例12: factory_propagates_class_not_found
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
@Test(expected = RuntimeException.class)
public void factory_propagates_class_not_found() {
Config clusterConfig = ConfigFactory.parseString("{\"" + ClusterClients.FACTORY_CLASS + "\":\"" + String.class.getName() + "\"," + //
"\"" + ClusterClients.FACTORY_CONFIG + "\":{}}");
ClusterClients.newFactory(AgentClusterClientFactory.class, clusterConfig, actorRegistry);
}
示例13: invalidClassClusterConfig
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static Config invalidClassClusterConfig() {
return ConfigFactory.parseString("{\"" + ClusterClients.FACTORY_CLASS + "\":\"dummy\"," + //
"\"" + ClusterClients.FACTORY_CONFIG + "\":{}}");
}
示例14: leaderConfig
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
@Override
public Config leaderConfig() {
return ConfigFactory.parseString("{\"" + ClusterClients.FACTORY_CLASS + "\":\"" + JGROUPS_LEADER_FACTORY_CLASS + "\"," + //
"\"" + ClusterClients.FACTORY_CONFIG + "\":" + jgroupsFactoryConfigJson() + "}");
}
示例15: clusterConfig
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
@Override
public Config clusterConfig() {
return ConfigFactory.parseString("{\"" + ClusterClients.FACTORY_CLASS + "\":\"" + JGROUPS_FACTORY_CLASS + "\"," + //
"\"" + ClusterClients.FACTORY_CONFIG + "\":" + jgroupsFactoryConfigJson() + "}");
}