Class GuiceModuleLoader

  • All Implemented Interfaces:
    com.google.inject.Module

    public class GuiceModuleLoader
    extends com.google.inject.AbstractModule
    Implementation for loading of Guice modules on same principles discussed on StackOverflow, however this implementation uses Typesafe Config instead of Java ServiceLoader to allow for further configuration than only "detected".
    Author:
    erlend
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void configure()  
      protected static <T,​R>
      Predicate<T>
      distinctByKey​(Function<? super T,​R> function)  
      protected static List<com.google.inject.Module> getModules()  
      static com.google.inject.Injector initiate​(com.google.inject.Module... modules)  
      protected static com.google.inject.Module load​(com.typesafe.config.Config config)  
      protected static com.google.inject.Module loadModule​(String className)  
      • 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
    • Constructor Detail

      • GuiceModuleLoader

        public GuiceModuleLoader()
    • Method Detail

      • initiate

        public static com.google.inject.Injector initiate​(com.google.inject.Module... modules)
      • configure

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

        protected static List<com.google.inject.Module> getModules()
      • load

        protected static com.google.inject.Module load​(com.typesafe.config.Config config)
      • loadModule

        protected static com.google.inject.Module loadModule​(String className)
      • distinctByKey

        protected static <T,​R> Predicate<T> distinctByKey​(Function<? super T,​R> function)