@Override public final void initialize(Bootstrap<?> bootstrap) { bootstrap.getObjectMapper().registerModule(createHibernate5Module()); }
@Override public void initialize(Bootstrap<?> bootstrap) { bootstrap.getObjectMapper().setDateFormat(new StdDateFormat()); bootstrap.getObjectMapper().registerModule(new JtsModule()); bootstrap.getObjectMapper().registerModule(new GraphHopperModule()); bootstrap.getObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL); // Because VirtualEdgeIteratorState has getters which throw Exceptions. // http://stackoverflow.com/questions/35359430/how-to-make-jackson-ignore-properties-if-the-getters-throw-exceptions bootstrap.getObjectMapper().registerModule(new SimpleModule().setSerializerModifier(new BeanSerializerModifier() { @Override public List<BeanPropertyWriter> changeProperties(SerializationConfig config, BeanDescription beanDesc, List<BeanPropertyWriter> beanProperties) { return beanProperties.stream().map(bpw -> new BeanPropertyWriter(bpw) { @Override public void serializeAsField(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception { try { super.serializeAsField(bean, gen, prov); } catch (Exception e) { // Ignoring expected exception, see above. } } }).collect(Collectors.toList()); } })); }
@Override public void initialize(Bootstrap<GraphHopperServerConfiguration> bootstrap) { bootstrap.addBundle(new GraphHopperBundle()); bootstrap.addBundle(new ConfiguredAssetsBundle("/assets/", "/maps/", "index.html")); bootstrap.addCommand(new ImportCommand(bootstrap.getObjectMapper())); }
@Override @SuppressWarnings("unchecked") public void run(Bootstrap<?> wildcardBootstrap, Namespace namespace) throws Exception { final Bootstrap<T> bootstrap = (Bootstrap<T>) wildcardBootstrap; configuration = parseConfiguration(bootstrap.getConfigurationFactoryFactory(), bootstrap.getConfigurationSourceProvider(), bootstrap.getValidatorFactory().getValidator(), namespace.getString("file"), getConfigurationClass(), bootstrap.getObjectMapper()); try { if (configuration != null) { configuration.getLoggingFactory().configure(bootstrap.getMetricRegistry(), bootstrap.getApplication().getName()); } run(bootstrap, namespace, configuration); } finally { if (!asynchronous) { cleanup(); } } }
@Override protected void run(Bootstrap<T> bootstrap, Namespace namespace, T configuration) throws Exception { final Environment environment = new Environment(bootstrap.getApplication().getName(), bootstrap.getObjectMapper(), bootstrap.getValidatorFactory(), bootstrap.getMetricRegistry(), bootstrap.getClassLoader(), bootstrap.getHealthCheckRegistry()); configuration.getMetricsFactory().configure(environment.lifecycle(), bootstrap.getMetricRegistry()); configuration.getServerFactory().configure(environment); bootstrap.run(configuration, environment); application.run(configuration, environment); run(environment, namespace, configuration); }
@Override public void initialize(Bootstrap<TimelockBenchmarkServerConfig> bootstrap) { bootstrap.getObjectMapper().registerModule(new Jdk8Module()); bootstrap.getObjectMapper().registerSubtypes(NonBlockingFileAppenderFactory.class); super.initialize(bootstrap); }
@Override public void initialize(Bootstrap<TimeLockServerConfiguration> bootstrap) { MetricRegistry metricRegistry = SharedMetricRegistries .getOrCreate("AtlasDbTest" + UUID.randomUUID().toString()); TaggedMetricRegistry taggedMetricRegistry = new DefaultTaggedMetricRegistry(); bootstrap.setMetricRegistry(metricRegistry); bootstrap.getObjectMapper().registerSubtypes(NonBlockingFileAppenderFactory.class); bootstrap.getObjectMapper().registerModule(new Jdk8Module()); super.initialize(bootstrap); }
@Override public void initialize(Bootstrap<TimelockBenchmarkClientConfig> bootstrap) { MetricRegistry metricRegistry = MetricRegistries.createWithHdrHistogramReservoirs(); bootstrap.setMetricRegistry(metricRegistry); bootstrap.getObjectMapper().registerModule(new Jdk8Module()); bootstrap.getObjectMapper().registerSubtypes(NonBlockingFileAppenderFactory.class); super.initialize(bootstrap); }
@Override public void initialize(Bootstrap<AtlasDbEteConfiguration> bootstrap) { bootstrap.setMetricRegistry(SharedMetricRegistries.getOrCreate("AtlasDbTest")); enableEnvironmentVariablesInConfig(bootstrap); bootstrap.getObjectMapper().registerModule(new Jdk8Module()); }
@Override public void initialize(Bootstrap<Configuration> bootstrap) { bootstrap.getObjectMapper().registerModule(new Jdk8Module()); }
@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())); bootstrap.getObjectMapper().registerModule(new ProtobufModule()); bootstrap.getObjectMapper().registerModule(new GuavaModule()); bootstrap.getObjectMapper().setSerializationInclusion(Include.NON_NULL); bootstrap.getObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@Override protected void run(Bootstrap<T> bootstrap, Namespace namespace, T configuration) throws Exception { final Environment environment = new Environment(bootstrap.getApplication().getName(), bootstrap.getObjectMapper(), bootstrap.getValidatorFactory().getValidator(), bootstrap.getMetricRegistry(), bootstrap.getClassLoader(), bootstrap.getHealthCheckRegistry()); configuration.getMetricsFactory().configure(environment.lifecycle(), bootstrap.getMetricRegistry()); configuration.getServerFactory().configure(environment); bootstrap.run(configuration, environment); application.run(configuration, environment); run(environment, namespace, configuration); }
@Override @SuppressWarnings("unchecked") public void run(Bootstrap<?> wildcardBootstrap, Namespace namespace) throws Exception { final Bootstrap<T> bootstrap = (Bootstrap<T>) wildcardBootstrap; configuration = parseConfiguration(bootstrap.getConfigurationFactoryFactory(), bootstrap.getConfigurationSourceProvider(), bootstrap.getValidatorFactory().getValidator(), namespace.getString("file"), getConfigurationClass(), bootstrap.getObjectMapper()); try { if (configuration != null) { configuration.getLoggingFactory().configure(bootstrap.getMetricRegistry(), bootstrap.getApplication().getName()); } run(bootstrap, namespace, configuration); } finally { if (!asynchronous) { cleanup(); } } }
@Override public void initialize(Bootstrap<SpringServiceConfiguration> bootstrap) { // This is needed to avoid an exception when deserializing Json to an ArrayList<String> bootstrap.getObjectMapper().enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); }
@Override public void initialize(Bootstrap<C> bootstrap) { this.addModule(new AccountsModule()); bootstrap.getObjectMapper().registerModule(new NIOModule()); bootstrap.getObjectMapper().registerModule(new MayocatJodaModule()); bootstrap.getObjectMapper().registerModule(new MayocatLocaleBCP47LanguageTagModule()); bootstrap.getObjectMapper().registerModule(new TimeZoneModule()); bootstrap.getObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); // TODO: remove when upgrading DW to 0.8 bootstrap.getObjectMapper().registerModule(new PermissiveFuzzyEnumModule()); }
@Override public void initialize(Bootstrap<RxJerseyConfiguration> bootstrap) { bootstrap.getObjectMapper() .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); bootstrap.addBundle(new RxJerseyBundle<RxJerseyConfiguration>() .setClientConfigurationProvider(config -> config.client) .register(HeaderInterceptor.class) ); }
@Override public void initialize(final Bootstrap<?> bootstrap) { bootstrap.getObjectMapper().registerModules(new Jdk8Module()); bootstrap.getObjectMapper().registerModules(new JavaTimeModule()); final ValidatorFactory validatorFactory = Validators.newConfiguration() .addValidatedValueHandler(new OptionalValidatedValueUnwrapper()) .buildValidatorFactory(); bootstrap.setValidatorFactory(validatorFactory); }
@Override public void initialize(Bootstrap<GraphHopperServerConfiguration> bootstrap) { bootstrap.addBundle(new GraphHopperBundle()); bootstrap.addBundle(new ConfiguredAssetsBundle("/assets/", "/maps/", "index.html")); bootstrap.addCommand(new ImportCommand(bootstrap.getObjectMapper())); }
@Before public void setUp() throws Exception { ObjectMapper objectMapper = Jackson.newObjectMapper(); environment = new Environment("test env", objectMapper, null, new MetricRegistry(), null); guiceBundle = GuiceBundle.defaultBuilder(Configuration.class) .modules(new TestModule()) .build(); Bootstrap bootstrap = mock(Bootstrap.class); when(bootstrap.getObjectMapper()).thenReturn(objectMapper); guiceBundle.initialize(bootstrap); guiceBundle.run(new Configuration(), environment); }
@Override public void initialize(Bootstrap<EmoConfiguration> bootstrap) { bootstrap.addCommand(new CreateKeyspacesCommand()); bootstrap.addCommand(new RegisterCassandraCommand()); bootstrap.addCommand(new ListCassandraCommand()); bootstrap.addCommand(new UnregisterCassandraCommand()); bootstrap.addCommand(new PurgeDatabusEventsCommand()); bootstrap.addCommand(new AllTablesReportCommand()); bootstrap.addCommand(new EncryptConfigurationApiKeyCommand()); EmoServiceObjectMapperFactory.configure(bootstrap.getObjectMapper()); bootstrap.getMetricRegistry().register("jvm.gc.totals", new EmoGarbageCollectorMetricSet()); }