@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(); } }); } }
@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(); }
@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")); }
@Override public void initialize(Bootstrap<IssueConfiguration> bootstrap) { bootstrap.setConfigurationSourceProvider( new ResourceConfigurationSourceProvider()); }