io.dropwizard.java8.Java8Bundle Java Examples

The following examples show how to use io.dropwizard.java8.Java8Bundle. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TodoListApplication.java    From dropwizard-experiment with MIT License 6 votes vote down vote up
@Override
public void initialize(Bootstrap<TodoListConfiguration> bootstrap) {
    ebeanBundle = new EbeanBundle();
    //rabbitMqBundle = new RabbitMQBundle();

    // This outputs xDateTimes as ISO strings rather than an array of numbers in JSON.
    bootstrap.getObjectMapper().disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);

    bootstrap.addBundle(new Java8Bundle());
    bootstrap.addBundle(ebeanBundle);
    //bootstrap.addBundle(rabbitMqBundle);
    bootstrap.addBundle(new OAuth2Bundle(ebeanBundle));
    bootstrap.addBundle(new TodoClientBundle());
    bootstrap.addBundle(new MigrationsBundle<TodoListConfiguration>() {
        @Override
        public DataSourceFactory getDataSourceFactory(TodoListConfiguration configuration) {
            return configuration.getDatabaseConfig();
        }
    });

    // The anonymous subclass seems to be needed for the config type to be picked up correctly.
    bootstrap.addCommand(new WorkersCommand<TodoListConfiguration>(TodoListApplication.this) {});
    bootstrap.addCommand(new DbDiffCommand<TodoListConfiguration>() {});
}
 
Example #2
Source File: Main.java    From dcos-cassandra-service with Apache License 2.0 5 votes vote down vote up
@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));
}
 
Example #3
Source File: Main.java    From dcos-cassandra-service with Apache License 2.0 5 votes vote down vote up
@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))));
}
 
Example #4
Source File: DropwizardApplication.java    From microservices-comparison with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(Bootstrap<DropwizardServerConfiguration> bootstrap) {
    guiceBundle = GuiceBundle.<DropwizardServerConfiguration>newBuilder()
            .addModule(new HelloModule())
            .addModule(new CarModule())
            .setConfigClass(DropwizardServerConfiguration.class)
            .build();
    bootstrap.addBundle(guiceBundle);
    bootstrap.addBundle(new Java8Bundle());

    ObjectMapper objectMapper = bootstrap.getObjectMapper();
    objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}