org.neo4j.kernel.configuration.Config.fromSettings()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中org.neo4j.kernel.configuration.Config.fromSettings()方法的一些代码示例,展示了Config.fromSettings()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.fromSettings()方法的具体详情如下:
包路径:org.neo4j.kernel.configuration.Config
类名称:Config
方法名:fromSettings

Config.fromSettings介绍

[英]Convenient method for starting building from initial settings.
[中]从初始设置开始构建的便捷方法。

代码示例

代码示例来源:origin: neo4j/neo4j

private static Config Config( Map<String,String> params )
{
  return Config.fromSettings( params )
         .withConfigClasses( Arrays.asList( mySettingsWithDefaults, myMigratingSettings ) ).build();
}

代码示例来源:origin: neo4j/neo4j

private static Config createConfig()
{
  Map<String, String> configProps = new HashMap<>();
  configProps.put( new BoltConnector( CONNECTOR ).enabled.name(), "TRUE" );
  configProps.put( new BoltConnector( CONNECTOR ).listen_address.name(), "localhost:0" );
  configProps.put( new BoltConnector( CONNECTOR ).type.name(), BoltConnector.ConnectorType.BOLT.name() );
  configProps.put( new BoltConnector( CONNECTOR ).thread_pool_min_size.name(), "5" );
  configProps.put( new BoltConnector( CONNECTOR ).thread_pool_max_size.name(), "10" );
  return Config.fromSettings( configProps ).build();
}

代码示例来源:origin: neo4j/neo4j

@Test
void shouldDeriveListenAddressFromDefaultListenAddress()
{
  // given
  Config config = Config.fromSettings( stringMap( "dbms.connector.https.enabled", "true",
      "dbms.connector.http.enabled", "true",
      "dbms.connectors.default_listen_address", "0.0.0.0" ) ).withServerDefaults().build();
  // then
  assertEquals( 2, config.enabledHttpConnectors().size() );
  config.enabledHttpConnectors().forEach( c ->
      assertEquals( "0.0.0.0", config.get( c.listen_address ).getHostname() ) );
}

代码示例来源:origin: org.neo4j/neo4j-backup

private Config loadAdditionalConfigFile( Path path )
  {
    try ( InputStream in = Files.newInputStream( path ) )
    {
      return Config.fromSettings( MapUtil.load( in ) ).build();
    }
    catch ( IOException e )
    {
      throw new UncheckedIOException(
          "Could not read additional configuration from " + path + ". " +
          "The file either does not exist, is not a regular file, or is not readable.", e );
    }
  }
}

相关文章