Java 类io.dropwizard.configuration.ResourceConfigurationSourceProvider 实例源码

项目:microservice-bundle    文件:µService.java   
@Override
public void initialize(Bootstrap<C> bootstrap) {
  bootstrap.setConfigurationSourceProvider(
      new SubstitutingSourceProvider(new ResourceConfigurationSourceProvider(),
          new EnvironmentVariableSubstitutor(false))
  );
  µsBundle.Builder<C> µsBundleBuilder = µsBundle.<C>newBuilder();
  initialize(µsBundleBuilder);
  µsBundleInstance = µsBundleBuilder.setConfigClass(getConfigurationClass()).addGuiceLifecycleListener(this).build();
  bootstrap.addBundle(µsBundleInstance);
  if (ZipkinAware.class.isAssignableFrom(getConfigurationClass())) {
    logger.info("Register " + ZipkinBundle.class.getSimpleName() + " ...");
    bootstrap.addBundle(new ZipkinBundle<C>(getName()) {
      @Override
      public ZipkinFactory getZipkinFactory(C c) {
        return ((ZipkinAware)c).getZipkin();
      }
    });
  }
}
项目:dropwizard-hikaricp-benchmark    文件:HikariDataSourceFactoryTest.java   
@Test
public void canDeserializeCorrectly() throws IOException, ConfigurationException {
    final HikariDataSourceFactory factory = new YamlConfigurationFactory<>(HikariDataSourceFactory.class,
            BaseValidator.newValidator(), Jackson.newObjectMapper(), "dw")
            .build(new ResourceConfigurationSourceProvider(), "config.yaml");

    assertThat(factory.getUser()).isEqualTo("nick");
    assertThat(factory.getPassword()).isEqualTo("nickss");
    assertThat(factory.getDatasourceClassName()).isEqualTo("org.postgresql.ds.PGSimpleDataSource");
    assertThat(factory.getProperties()).containsExactly(entry("databaseName", "postgres"));
    assertThat(factory.getMinSize()).isEqualTo(OptionalInt.empty());
    assertThat(factory.getMaxSize()).isEqualTo(12);
    assertThat(factory.isAutoCommit()).isTrue();
}
项目:referenceapp    文件:AdminUIApplication.java   
@Override
  public void initialize(Bootstrap<AdminUIConfiguration> bootstrap) {
bootstrap.setConfigurationSourceProvider(new ResourceConfigurationSourceProvider());
bootstrap.addBundle(new AssetsBundle("/assets", "/pages"));
bootstrap.addBundle(new AssetsBundle("/assets/css", "/css", null, "css"));
bootstrap.addBundle(new AssetsBundle("/assets/js", "/js", null, "js"));
bootstrap.addBundle(new AssetsBundle("/assets/json", "/json", null, "json"));

// We shouldn't have to do this: Zuul forwarding doesn't like the first
// json exposure for some reason
bootstrap.addBundle(new AssetsBundle("/assets/json", "/pages/json", null, "json2"));

  }
项目:squiggly-filter-jackson    文件:IssueApplication.java   
@Override
public void initialize(Bootstrap<IssueConfiguration> bootstrap) {
    bootstrap.setConfigurationSourceProvider(
            new ResourceConfigurationSourceProvider());
}