Class 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:
    for more info on usage, GuiceyOptions.BindConfigurationByPath
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void configure()  
      • 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, requestStaticInjection, requireBinding, requireBinding
      • Methods inherited from class java.lang.Object

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

      • ConfigBindingModule

        public ConfigBindingModule​(io.dropwizard.Configuration configuration,
                                   ConfigurationTree tree)
    • Method Detail

      • configure

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