Source:
private Injector initInjector() { try { List<Module> modulesToLoad = new ArrayList<>(); modulesToLoad.add(LifecycleSupport.getModule()); modulesToLoad.add(SchedulerSupport.getModule()); modulesToLoad.add(new Configuration(ninjaProperties)); modulesToLoad.add(new AbstractModule() { @Override protected void configure() { bind(Context.class).to(ContextImpl.class); } }); Optional<String> applicationModulesBasePackage = Optional.fromNullable(ninjaProperties.get( NinjaConstant.APPLICATION_MODULES_BASE_PACKAGE)); String applicationConfigurationClassName = getClassNameWithOptionalUserDefinedPrefix( applicationModulesBasePackage, APPLICATION_GUICE_MODULE_CONVENTION_LOCATION); if (doesClassExist(applicationConfigurationClassName)) { Class<?> applicationConfigurationClass = Class .forName(applicationConfigurationClassName); AbstractModule applicationConfiguration = (AbstractModule) applicationConfigurationClass .getConstructor().newInstance(); modulesToLoad.add(applicationConfiguration); } String servletModuleClassName = getClassNameWithOptionalUserDefinedPrefix( applicationModulesBasePackage, APPLICATION_GUICE_SERVLET_MODULE_CONVENTION_LOCATION); if (doesClassExist(servletModuleClassName)) { Class<?> servletModuleClass = Class .forName(servletModuleClassName); ServletModule servletModule = (ServletModule) servletModuleClass .getConstructor().newInstance(); modulesToLoad.add(servletModule); } else { ServletModule servletModule = new ServletModule() { @Override protected void configureServlets() { bind(NinjaServletDispatcher.class).asEagerSingleton(); serve("/*").with(NinjaServletDispatcher.class); } }; modulesToLoad.add(servletModule); } initializeUserSuppliedConfNinjaOrNinjaDefault( applicationModulesBasePackage, modulesToLoad); injector = Guice.createInjector(Stage.PRODUCTION, modulesToLoad); initializeRouterWithRoutesOfUserApplication(applicationModulesBasePackage); return injector; } catch (Exception exception) { injectorException = exception; if (logInjectorException) { logger.error("Fatal error booting Ninja", exception); } } return null; }

Target:
private Injector initInjector() throws Exception { List<Module> modulesToLoad = new ArrayList<>(); modulesToLoad.add(LifecycleSupport.getModule()); modulesToLoad.add(SchedulerSupport.getModule()); modulesToLoad.add(new Configuration(ninjaProperties)); modulesToLoad.add(new AbstractModule() { @Override protected void configure() { bind(Context.class).to(ContextImpl.class); } }); Optional<String> applicationModulesBasePackage = Optional.fromNullable(ninjaProperties.get( NinjaConstant.APPLICATION_MODULES_BASE_PACKAGE)); String applicationConfigurationClassName = getClassNameWithOptionalUserDefinedPrefix( applicationModulesBasePackage, APPLICATION_GUICE_MODULE_CONVENTION_LOCATION); if (doesClassExist(applicationConfigurationClassName)) { Class<?> applicationConfigurationClass = Class .forName(applicationConfigurationClassName); AbstractModule applicationConfiguration = (AbstractModule) applicationConfigurationClass .getConstructor().newInstance(); modulesToLoad.add(applicationConfiguration); } String servletModuleClassName = getClassNameWithOptionalUserDefinedPrefix( applicationModulesBasePackage, APPLICATION_GUICE_SERVLET_MODULE_CONVENTION_LOCATION); if (doesClassExist(servletModuleClassName)) { Class<?> servletModuleClass = Class .forName(servletModuleClassName); ServletModule servletModule = (ServletModule) servletModuleClass .getConstructor().newInstance(); modulesToLoad.add(servletModule); } else { ServletModule servletModule = new ServletModule() { @Override protected void configureServlets() { bind(NinjaServletDispatcher.class).asEagerSingleton(); serve("/*").with(NinjaServletDispatcher.class); } }; modulesToLoad.add(servletModule); } initializeUserSuppliedConfNinjaOrNinjaDefault( applicationModulesBasePackage, modulesToLoad); injector = Guice.createInjector(Stage.PRODUCTION, modulesToLoad); initializeRouterWithRoutesOfUserApplication(applicationModulesBasePackage); return injector; }