Class ConfigBindingModule

java.lang.Object
com.google.inject.AbstractModule
ru.vyarus.dropwizard.guice.module.yaml.bind.ConfigBindingModule
All Implemented Interfaces:
com.google.inject.Module

public class ConfigBindingModule extends com.google.inject.AbstractModule
Binds configuration constants. Bindings are qualified with Config.

Note that not all configuration paths may be available because configuration is introspected using jersey serialization api and some configuration classes may only consume properties (e.g. value consumed directly in setter - impossible to read back).

All content types are bound by declaration type (as they declared in configuration class). All primitive types are boxed. All collection types like List, Set, Map, Multimap are bound by collection type (List, Set etc). Generics are always used in binding (so @inject @Config("path") List<String> val will work and @inject @Config("path") List val will not).

Root configuration objects are bound with and without qualifier, except root interfaces which are bound with qualifier only.

ConfigurationTree instance is also bound directly to be used for custom configuration analysis.

Since:
04.05.2018
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    ConfigBindingModule(io.dropwizard.core.Configuration configuration, ConfigurationTree tree)
    Create configuration bindings module.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
     

    Methods inherited from class com.google.inject.AbstractModule

    addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindListener, bindScope, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestInjection, requestStaticInjection, requireBinding, requireBinding

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ConfigBindingModule

      public ConfigBindingModule(io.dropwizard.core.Configuration configuration, ConfigurationTree tree)
      Create configuration bindings module.
      Parameters:
      configuration - configuration instance.
      tree - parsed configuration
  • Method Details

    • configure

      protected void configure()
      Overrides:
      configure in class com.google.inject.AbstractModule