本文整理了Java中io.dropwizard.setup.Bootstrap.setConfigurationSourceProvider()
方法的一些代码示例,展示了Bootstrap.setConfigurationSourceProvider()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bootstrap.setConfigurationSourceProvider()
方法的具体详情如下:
包路径:io.dropwizard.setup.Bootstrap
类名称:Bootstrap
方法名:setConfigurationSourceProvider
[英]Sets the bootstrap's ConfigurationSourceProvider.
[中]设置引导的ConfigurationSourceProvider。
代码示例来源:origin: dropwizard/dropwizard
@Override
public void initialize(Bootstrap<HelloWorldConfiguration> bootstrap) {
// Enable variable substitution with environment variables
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(
bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false)
)
);
bootstrap.addCommand(new RenderCommand());
bootstrap.addBundle(new AssetsBundle());
bootstrap.addBundle(new MigrationsBundle<HelloWorldConfiguration>() {
@Override
public DataSourceFactory getDataSourceFactory(HelloWorldConfiguration configuration) {
return configuration.getDataSourceFactory();
}
});
bootstrap.addBundle(hibernateBundle);
bootstrap.addBundle(new ViewBundle<HelloWorldConfiguration>() {
@Override
public Map<String, Map<String, String>> getViewConfiguration(HelloWorldConfiguration configuration) {
return configuration.getViewRendererConfiguration();
}
});
}
代码示例来源:origin: palantir/atlasdb
private void enableEnvironmentVariablesInConfig(Bootstrap<AtlasDbEteConfiguration> bootstrap) {
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(
bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor()));
}
}
代码示例来源:origin: HubSpot/Singularity
@Override
public void initialize(final Bootstrap<T> bootstrap) {
if (!Strings.isNullOrEmpty(System.getProperty(SINGULARITY_DEFAULT_CONFIGURATION_PROPERTY))) {
bootstrap.setConfigurationSourceProvider(new MergingSourceProvider(bootstrap.getConfigurationSourceProvider(), System.getProperty(SINGULARITY_DEFAULT_CONFIGURATION_PROPERTY), bootstrap.getObjectMapper(), new YAMLFactory()));
代码示例来源:origin: com.github.autoscaler/autoscale-core
@Override
public void initialize(Bootstrap<AutoscaleConfiguration> bootstrap)
{
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(false, true))
);
}
代码示例来源:origin: trellis-ldp/trellis
@Override
public void initialize(final Bootstrap<T> bootstrap) {
// Allow configuration property substitution from environment variables
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false)));
}
代码示例来源:origin: rvs-fluid-it/wizard-in-a-box
@Override
public void initialize(Bootstrap<C> bootstrap) {
if (configurationBridge != null) {
bootstrap.setConfigurationFactoryFactory(new BridgedConfigurationFactoryFactory<C>(configurationBridge));
}
// Swaps the default FileConfigurationSourceProvider
bootstrap.setConfigurationSourceProvider(new ClasspathConfigurationSourceProvider());
dropwizardApplication.initialize(bootstrap);
}
代码示例来源:origin: com.github.workerframework/worker-core
@Override
public void initialize(Bootstrap<WorkerConfiguration> bootstrap)
{
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(false, true))
);
}
代码示例来源:origin: jeqo/talk-kafka-zipkin
@Override
public void initialize(Bootstrap<TranslationServiceConfiguration> bootstrap) {
// Enable variable substitution with environment variables
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false)));
}
代码示例来源:origin: MarquezProject/marquez
@Override
public void initialize(@NonNull Bootstrap<MarquezConfig> bootstrap) {
// Enable variable substitution with environment variables.
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(
bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(ERROR_ON_UNDEFINED)));
// Enable Flyway for database migrations.
bootstrap.addBundle(
new FlywayBundle<MarquezConfig>() {
@Override
public DataSourceFactory getDataSourceFactory(@NonNull MarquezConfig config) {
return config.getDataSourceFactory();
}
@Override
public FlywayFactory getFlywayFactory(@NonNull MarquezConfig config) {
return config.getFlywayFactory();
}
});
}
代码示例来源:origin: alphagov/pay-publicapi
@Override
public void initialize(Bootstrap<PublicApiConfig> bootstrap) {
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(
bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false)
)
);
bootstrap.addBundle(new JedisBundle<PublicApiConfig>() {
@Override
public JedisFactory getJedisFactory(PublicApiConfig configuration) {
return configuration.getJedisFactory();
}
});
}
代码示例来源:origin: wireapp/lithium
@Override
public void initialize(Bootstrap<Config> bootstrap) {
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false)
)
);
bootstrap.addBundle(new SwaggerBundle<Config>() {
@Override
protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(Config configuration) {
return configuration.getSwagger();
}
});
}
代码示例来源:origin: mesosphere/dcos-commons
@Override
public void initialize(Bootstrap<KeystoreConfiguration> bootstrap) {
// Enable variable substitution with environment variables
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(
bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false)
)
);
bootstrap.addCommand(new TLSTruststoreTestCommand<>(this));
}
代码示例来源:origin: soabase/soabase
public void initialize(Bootstrap<ExampleConfiguration> bootstrap)
{
bootstrap.setConfigurationSourceProvider(new FlexibleConfigurationSourceProvider());
bootstrap.addBundle(new CuratorBundle<>());
bootstrap.addBundle(new SqlBundle<>());
bootstrap.addBundle(new SoaBundle<>());
}
代码示例来源:origin: homeaway/stream-registry
@Override
public void initialize(final Bootstrap<StreamRegistryConfiguration> bootstrap) {
// EnvironmentVariableSubstitutor enables EnvVariables to be substituted into the configuration before initialization
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false)
)
);
bootstrap.addBundle(new SwaggerBundle<StreamRegistryConfiguration>() {
@Override
protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(StreamRegistryConfiguration configuration) {
return configuration.getSwaggerBundleConfiguration();
}
});
metricRegistry = bootstrap.getMetricRegistry();
}
代码示例来源:origin: mesosphere/dcos-cassandra-service
@Override
public void initialize(Bootstrap<MutableSchedulerConfiguration> bootstrap) {
super.initialize(bootstrap);
StrSubstitutor strSubstitutor = new StrSubstitutor(new EnvironmentVariableLookup(false));
strSubstitutor.setEnableSubstitutionInVariables(true);
bootstrap.addBundle(new Java8Bundle());
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(
bootstrap.getConfigurationSourceProvider(),
strSubstitutor));
}
代码示例来源:origin: paukiatwee/budgetapp
@Override
public void initialize(Bootstrap<AppConfiguration> bootstrap) {
MigrationsBundle<AppConfiguration> migrationBundle = new MigrationsBundle<AppConfiguration>() {
@Override
public DataSourceFactory getDataSourceFactory(AppConfiguration configuration) {
return configuration.getDataSourceFactory();
}
};
// allow using Environment variable in yaml
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(
bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false)
)
);
bootstrap.addBundle(migrationBundle);
bootstrap.addBundle(hibernate);
bootstrap.addBundle(new ConfiguredAssetsBundle("/app", "/app", "index.html"));
}
代码示例来源:origin: mesosphere/dcos-cassandra-service
@Override
public void initialize(Bootstrap<CassandraExecutorConfiguration> bootstrap) {
super.initialize(bootstrap);
bootstrap.addBundle(new Java8Bundle());
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(
bootstrap.getConfigurationSourceProvider(),
new StrSubstitutor(
new EnvironmentVariableLookup(false))));
}
代码示例来源:origin: HuygensING/timbuctoo
@Override
public void initialize(Bootstrap<TimbuctooConfiguration> bootstrap) {
//bundles
activeMqBundle = new ActiveMQBundle();
bootstrap.addBundle(activeMqBundle);
bootstrap.addBundle(new MultiPartBundle());
bootstrap.addBundle(new AssetsBundle("/static", "/static", "index.html"));
/*
* Make it possible to use environment variables in the config.
* see: http://www.dropwizard.io/0.9.1/docs/manual/core.html#environment-variables
*/
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(
bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(true)
));
}
代码示例来源:origin: dropwizard/dropwizard-java8
@Override
public void initialize(Bootstrap<HelloWorldConfiguration> bootstrap) {
// Enable variable substitution with environment variables
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(
bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false)
)
);
bootstrap.addCommand(new RenderCommand());
bootstrap.addBundle(new Java8Bundle());
bootstrap.addBundle(new AssetsBundle());
bootstrap.addBundle(new MigrationsBundle<HelloWorldConfiguration>() {
@Override
public DataSourceFactory getDataSourceFactory(HelloWorldConfiguration configuration) {
return configuration.getDataSourceFactory();
}
});
bootstrap.addBundle(hibernateBundle);
bootstrap.addBundle(new ViewBundle<HelloWorldConfiguration>() {
@Override
public Map<String, Map<String, String>> getViewConfiguration(HelloWorldConfiguration configuration) {
return configuration.getViewRendererConfiguration();
}
});
}
代码示例来源:origin: soabase/soabase
@Override
public final void initialize(Bootstrap<T> bootstrap)
{
bootstrap.setConfigurationFactoryFactory(builder.getFactoryFactory());
bootstrap.setConfigurationSourceProvider(new FlexibleConfigurationSourceProvider());
ConfiguredBundle<T> bundle = new ConfiguredBundle<T>()
{
@Override
public void run(T configuration, Environment environment) throws Exception
{
DefaultServerFactory factory = new DefaultServerFactory();
factory.setAdminConnectors(Lists.<ConnectorFactory>newArrayList());
configuration.setServerFactory(factory);
}
@Override
public void initialize(Bootstrap<?> bootstrap)
{
// NOP
}
};
addBundles(bootstrap, BundleSpec.Phase.PRE_SOA);
bootstrap.addBundle(bundle);
bootstrap.addBundle(new SoaBundle<>());
bootstrap.addBundle(new ComponentBundle(builder.getAppName(), builder.getCompanyName(), builder.getFooterMessage(), builder.getTabs(), builder.getMetrics(), builder.getAuthSpec()));
bootstrap.addBundle(new AssetsBundle("/assets/soa"));
addBundles(bootstrap, BundleSpec.Phase.POST_SOA);
}
内容来源于网络,如有侵权,请联系作者删除!