本文整理汇总了Java中io.dropwizard.setup.Bootstrap类的典型用法代码示例。如果您正苦于以下问题:Java Bootstrap类的具体用法?Java Bootstrap怎么用?Java Bootstrap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Bootstrap类属于io.dropwizard.setup包,在下文中一共展示了Bootstrap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import io.dropwizard.setup.Bootstrap; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<ApiConfig> bootstrap) {
guiceBundle = GuiceBundle.<ApiConfig>newBuilder()
.setConfigClass(ApiConfig.class)
.addModule(new MineBdModule())
.build();
bootstrap.addBundle(guiceBundle);
SwaggerBundle<ApiConfig> swagger = new SwaggerBundle<ApiConfig>() {
@Override
protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(ApiConfig configuration) {
return configuration.swagger;
}
};
bootstrap.addBundle(swagger);
}
示例2: initialize
import io.dropwizard.setup.Bootstrap; //导入依赖的package包/类
@Override
public void initialize(final Bootstrap<EndpointConfiguration> bootstrap) {
bootstrap.getObjectMapper().configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
bootstrap.addBundle(new SwaggerBundle<EndpointConfiguration>() {
@Override
protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(
EndpointConfiguration configuration) {
return configuration.swagger;
}
});
}
示例3: initialize
import io.dropwizard.setup.Bootstrap; //导入依赖的package包/类
@Override
public final void initialize(Bootstrap<StubEventSinkConfiguration> bootstrap) {
// Enable variable substitution with environment variables
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false)
)
);
GuiceBundle<StubEventSinkConfiguration> guiceBundle = defaultBuilder(StubEventSinkConfiguration.class)
.modules(new StubEventSinkModule())
.build();
bootstrap.addBundle(guiceBundle);
bootstrap.addBundle(new ServiceStatusBundle());
bootstrap.addBundle(new MonitoringBundle());
bootstrap.addBundle(new LoggingBundle());
}
示例4: initialize
import io.dropwizard.setup.Bootstrap; //导入依赖的package包/类
@Override
public final void initialize(Bootstrap<SamlProxyConfiguration> bootstrap) {
// Enable variable substitution with environment variables
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false)
)
);
guiceBundle = defaultBuilder(SamlProxyConfiguration.class)
.modules(new SamlProxyModule())
.build();
bootstrap.addBundle(guiceBundle);
bootstrap.addBundle(new ServiceStatusBundle());
bootstrap.addBundle(new MonitoringBundle());
bootstrap.addBundle(new LoggingBundle());
}
示例5: initialize
import io.dropwizard.setup.Bootstrap; //导入依赖的package包/类
@Override
public final void initialize(Bootstrap<PolicyConfiguration> bootstrap) {
// Enable variable substitution with environment variables
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false)
)
);
bootstrap.addBundle(new ServiceStatusBundle());
bootstrap.addBundle(new MonitoringBundle());
bootstrap.addBundle(new LoggingBundle());
bootstrap.addBundle(new IdaJsonProcessingExceptionMapperBundle());
final InfinispanBundle infinispanBundle = new InfinispanBundle();
// the infinispan cache manager needs to be lazy loaded because it is not initialized at this point.
bootstrap.addBundle(infinispanBundle);
guiceBundle = GuiceBundle.defaultBuilder(PolicyConfiguration.class)
.modules(getPolicyModule(), bindInfinispan(infinispanBundle.getInfinispanCacheManagerProvider()))
.build();
bootstrap.addBundle(guiceBundle);
}
示例6: initialize
import io.dropwizard.setup.Bootstrap; //导入依赖的package包/类
@Override
public final void initialize(Bootstrap<SamlEngineConfiguration> bootstrap) {
// Enable variable substitution with environment variables
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false)
)
);
MDC.clear();
bootstrap.addBundle(new ServiceStatusBundle());
bootstrap.addBundle(new MonitoringBundle());
bootstrap.addBundle(new LoggingBundle());
bootstrap.addBundle(new IdaJsonProcessingExceptionMapperBundle());
final InfinispanBundle infinispanBundle = new InfinispanBundle();
bootstrap.addBundle(infinispanBundle);
guiceBundle = defaultBuilder(SamlEngineConfiguration.class)
.modules(new SamlEngineModule(), new CryptoModule(), bindInfinispan(infinispanBundle.getInfinispanCacheManagerProvider()))
.build();
bootstrap.addBundle(guiceBundle);
}
示例7: initialize
import io.dropwizard.setup.Bootstrap; //导入依赖的package包/类
@Override
public final void initialize(Bootstrap<SamlSoapProxyConfiguration> bootstrap) {
// Enable variable substitution with environment variables
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false)
)
);
bootstrap.addBundle(new IdaJsonProcessingExceptionMapperBundle());
guiceBundle = defaultBuilder(SamlSoapProxyConfiguration.class)
.modules(new SamlSoapProxyModule())
.build();
bootstrap.addBundle(guiceBundle);
bootstrap.addBundle(new ServiceStatusBundle());
bootstrap.addBundle(new MonitoringBundle());
bootstrap.addBundle(new LoggingBundle());
}
示例8: initialize
import io.dropwizard.setup.Bootstrap; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<ConfigConfiguration> bootstrap) {
// Enable variable substitution with environment variables
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false)
)
);
guiceBundle = GuiceBundle.defaultBuilder(ConfigConfiguration.class)
.modules(new ConfigModule())
.build();
bootstrap.addBundle(guiceBundle);
bootstrap.addBundle(new ServiceStatusBundle());
bootstrap.addBundle(new MonitoringBundle());
bootstrap.addBundle(new LoggingBundle());
}
示例9: initialize
import io.dropwizard.setup.Bootstrap; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<DropwizardConfiguration> bootstrap) {
guiceBundle = GuiceBundle.<DropwizardConfiguration>newBuilder()
.addModule(new AbstractModule() {
@Provides
public MongoManaged mongoManaged(DropwizardConfiguration configuration) throws Exception {
return new MongoManaged(configuration.mongo);
}
@Override
protected void configure() {
bind(ProjectRepository.class);
bind(TaskRepository.class);
bind(TaskToProjectRepository.class);
}
})
.setConfigClass(DropwizardConfiguration.class)
.build();
bootstrap.addBundle(guiceBundle);
}
示例10: run
import io.dropwizard.setup.Bootstrap; //导入依赖的package包/类
@Override
protected void run(Bootstrap<ApplicationConfig> bootstrap, Namespace namespace, ApplicationConfig applicationConfig) throws Exception {
final Path jobSpecsDir = Paths.get(applicationConfig.getJobSpecConfiguration().getDir());
final ArrayList<String> specIds = namespace.get(JOB_SPEC_IDS_ARGNAME);
final Map<JobSpecId, List<String>> allErrors =
specIds.stream()
.map(specId -> getSpecErrors(jobSpecsDir, specId))
.filter(entry -> entry.getValue().size() > 0)
.collect(toMap(e -> e.getKey(), e -> e.getValue()));
if (allErrors.size() > 0) {
allErrors.forEach(this::printErrors);
System.exit(1);
} else System.exit(0);
}
示例11: run
import io.dropwizard.setup.Bootstrap; //导入依赖的package包/类
@Override
protected void run(Bootstrap<ApplicationConfig> bootstrap, Namespace namespace, ApplicationConfig applicationConfig) throws Exception {
final String specId = namespace.get(SPEC_NAME_ARG);
final Path specsDir = Paths.get(applicationConfig.getJobSpecConfiguration().getDir());
final Path specFile = specsDir.resolve(specId).resolve(SPEC_DIR_SPEC_FILENAME);
if (specFile.toFile().exists()) {
final JobSpec jobSpec = readYAML(specFile, JobSpec.class);
final JobSpecId jobSpecId = new JobSpecId(specId);
final String jobName = new Faker().lorem().sentence(5);
final Map<JobExpectedInputId, JsonNode> generatedInputs = generateInputs(jobSpec);
final APIJobRequest jobRequest =
new APIJobRequest(jobSpecId, jobName, generatedInputs);
System.out.println(toJSON(jobRequest));
System.exit(0);
} else {
System.err.println(specFile + ": No such file");
System.exit(1);
}
}
示例12: initialize
import io.dropwizard.setup.Bootstrap; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<SECPConfiguration> bootstrap) {
bootstrap.addBundle(new AssetsBundle("/assets/app/", "/", "index.html"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/login", "index.html", "login"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/login/authenticate", "index.html", "authenticate"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/login/forgot-password", "index.html", "forgot-password"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/chats", "index.html", "chats"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal", "index.html", "portal"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/user-profile", "index.html", "user-profile"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/user-profile/change-password", "index.html", "change-password"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/group-profile", "index.html", "group-profile"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/audit", "index.html", "audit"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/audit/user", "index.html", "audit-user"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/audit/group", "index.html", "audit-group"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/manage", "index.html", "manage"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/manage/user", "index.html", "manage-user"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/manage/group", "index.html", "manage-group"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/configure", "index.html", "configure"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/configure/filter", "index.html", "tags"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/configure/tags", "index.html", "filter"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/error/404", "index.html", "404"));
bootstrap.addBundle(hibernateBundle);
ObjectMapper mapper = bootstrap.getObjectMapper();
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
}
示例13: initialize
import io.dropwizard.setup.Bootstrap; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<EtomicaServerConfig> bootstrap) {
bootstrap.setObjectMapper(mapper);
bootstrap.addBundle(GuiceBundle.builder()
.enableAutoConfig(getClass().getPackage().getName())
.modules(new WebSocketModule(), new EtomicaServerModule(bootstrap.getObjectMapper()))
.build()
);
WSConfigurator wsConfigurator = new WSConfigurator();
WebsocketBundle wsBundle = new WebsocketBundle(wsConfigurator);
wsBundle.addEndpoint(EchoServer.class);
wsBundle.addEndpoint(ConfigurationWebsocket.class);
wsBundle.addEndpoint(DataStreamWebsocket.class);
bootstrap.addBundle(wsBundle);
super.initialize(bootstrap);
}
示例14: initialize
import io.dropwizard.setup.Bootstrap; //导入依赖的package包/类
@Override
public final void initialize(Bootstrap<MatchingServiceAdapterConfiguration> bootstrap) {
// Enable variable substitution with environment variables
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false)
)
);
// Built in Stage.DEVELOPMENT for lazy loading of Singleton objects,
// this is required as we have Singletons which require the jersey
// Environment (not available at initialize)
//
// See this issue for updates on a lazy Singleton scope
//
// https://github.com/google/guice/issues/357
GuiceBundle<MatchingServiceAdapterConfiguration> guiceBundle = defaultBuilder(MatchingServiceAdapterConfiguration.class)
.modules(new MatchingServiceAdapterModule())
.build();
bootstrap.addBundle(guiceBundle);
bootstrap.addBundle(new LoggingBundle());
bootstrap.addBundle(new MonitoringBundle());
bootstrap.addBundle(new ServiceStatusBundle());
}
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:25,代码来源:MatchingServiceAdapterApplication.java
示例15: initialize
import io.dropwizard.setup.Bootstrap; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<ServerConfiguration> bootstrap) {
bootstrap.addBundle(hibernateBundle);
bootstrap.addBundle(new AssetsBundle("/swagger-spec", "/api-spec", null));
bootstrap.addBundle(GuiceBundle.<ServerConfiguration>newBuilder()
.addModule(new AbstractModule(){
@Override protected void configure() {}
@Provides SessionFactory sessionFactoryProvider() { return hibernateBundle.getSessionFactory();}
})
.setConfigClass(ServerConfiguration.class)
.enableAutoConfig(getClass().getPackage().getName())
.build(Stage.DEVELOPMENT)
);
bootstrap.addBundle(new Java8Bundle());
// Enable variable substitution with environment variables
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false)
)
);
}