当前位置: 首页>>代码示例>>Java>>正文


Java ConfigFactory.parseString方法代码示例

本文整理汇总了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);
}
 
开发者ID:conf4j,项目名称:conf4j,代码行数:17,代码来源:ConsulFileConfigurationSource.java

示例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);
    }
}
 
开发者ID:florentw,项目名称:bench,代码行数:8,代码来源:Actors.java

示例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);
    }
}
 
开发者ID:florentw,项目名称:bench,代码行数:8,代码来源:ActorBootstrap.java

示例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()) + "}");
}
 
开发者ID:florentw,项目名称:bench,代码行数:8,代码来源:JMSClusterConfigFactory.java

示例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));
}
 
开发者ID:florentw,项目名称:bench,代码行数:13,代码来源:ClusterClientsTest.java

示例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()) + "}");
}
 
开发者ID:florentw,项目名称:bench,代码行数:8,代码来源:JgroupsClusterConfigFactory.java

示例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) + "}");
}
 
开发者ID:florentw,项目名称:bench,代码行数:6,代码来源:JMSClusterConfigs.java

示例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) + "}");
}
 
开发者ID:florentw,项目名称:bench,代码行数:6,代码来源:JMSClusterConfigs.java

示例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) + "}");
}
 
开发者ID:florentw,项目名称:bench,代码行数:6,代码来源:JMSAgentCluster.java

示例10: toConfig

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public Config toConfig() {
    return ConfigFactory.parseString("{\"" + AgentConfig.AGENT_CLUSTER_TAG + "\":" + clusterConfigJson() + "}");
}
 
开发者ID:florentw,项目名称:bench,代码行数:4,代码来源:AgentConfig.java

示例11: TestActor

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
protected TestActor(final Sender sender) {
    this(DUMMY_ACTOR, sender, ConfigFactory.parseString(DUMMY_JSON_CONFIG));
}
 
开发者ID:florentw,项目名称:bench,代码行数:4,代码来源:TestActor.java

示例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);
}
 
开发者ID:florentw,项目名称:bench,代码行数:7,代码来源:ClusterClientsTest.java

示例13: invalidClassClusterConfig

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static Config invalidClassClusterConfig() {
    return ConfigFactory.parseString("{\"" + ClusterClients.FACTORY_CLASS + "\":\"dummy\"," + //
                                             "\"" + ClusterClients.FACTORY_CONFIG + "\":{}}");
}
 
开发者ID:florentw,项目名称:bench,代码行数:5,代码来源:JgroupsClusterConfigs.java

示例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() + "}");
}
 
开发者ID:florentw,项目名称:bench,代码行数:6,代码来源:JgroupsClusterConfigs.java

示例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() + "}");
}
 
开发者ID:florentw,项目名称:bench,代码行数:6,代码来源:JgroupsClusterConfigs.java


注:本文中的com.typesafe.config.ConfigFactory.parseString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。