@Override public Module module() { return BQCoreModule.builder().args(args) .bootLogger(bootLogger) .shutdownManager(shutdownManager) .moduleSource(moduleSource).build(); }
@Override public BQModule.Builder moduleBuilder() { return BQModuleProvider.super .moduleBuilder() .description("The core of Bootique runtime."); } };
@Override public Module module() { return binder -> BQCoreModule.extend(binder).setProperties(properties); }
/** * Returns a new instance of {@link io.bootique.BQModule.Builder} initialized with module for this provider. * Subclasses can invoke extra builder methods to provide metadata, etc. * * @return a new instance of {@link BQModule} specific to this provider. * @since 0.21 */ default BQModule.Builder moduleBuilder() { return BQModule .builder(module()) .overrides(overrides()) .providerName(name()) .configs(configs()); }
/** * Creates and returns an instance of {@link BQRuntime} that contains all Bootique services, commands, etc. * This method is only needed if you are managing Bootique execution sequence manually. Normally you'd be using * {@link #exec()} method instead of this method. * * @return a new {@link BQRuntime} instance that contains all Bootique services, commands, etc. * @since 0.13 */ public BQRuntime createRuntime() { Injector injector = createInjector(); return createRuntime(injector); }
private void calcOverrideGraph(Map<Class<? extends Module>, RuntimeModule> modules) { for (RuntimeModule rm : modules.values()) { for(Class<? extends Module> override : rm.getBqModule().getOverrides()) { RuntimeModule rmn = modules.get(override); if(rmn != null) { rmn.setOverriddenBy(rm); rm.setOverridesOthers(true); } } } }
/** * Instructs Bootique to load any modules available on classpath that expose {@link io.bootique.BQModuleProvider} * provider. Auto-loaded modules will be used in default configuration. Factories within modules will of course be * configured dynamically from YAML. * * @return this instance of test runtime builder. */ public T autoLoadModules() { bootique.autoLoadModules(); return (T) this; }
/** * @param moduleType custom Module class to add to Bootique DI runtime. * @return this instance of test runtime builder. * @see #autoLoadModules() */ public T module(Class<? extends Module> moduleType) { bootique.module(moduleType); return (T) this; }
/** * Declares a configuration variable for the given config path and given name. * * @param configPath a dot-separated "path" that navigates through the configuration tree to the property that * should be bound form a variable. E.g. "jdbc.myds.password". * @param name public name of the variable. * @return this extender instance. */ public BQCoreModuleExtender declareVar(String configPath, String name) { return declareVar(configPath, name, null); }
/** * Appends extra values to the test CLI arguments. * * @param args extra args to pass to Bootique. * @return this instance of test runtime builder. */ public T args(Collection<String> args) { bootique.args(args); return (T) this; }
@Override public T with(Module module) { subBuilder.with(module); return (T) BQTestRuntimeBuilder.this; } };
/** * Adds an array of Modules to the Bootique DI runtime. * * @param modules an array of modules to add to Bootiqie DI runtime. * @return this instance of test runtime builder. */ public T modules(Module... modules) { bootique.modules(modules); return (T) this; }
/** * Starts a builder of Bootique runtime. * * @param args command-line arguments. * @return Bootique object that can be customized and then executed as an app via {@link #exec()} method. */ public static Bootique app(String... args) { if (args == null) { args = new String[0]; } return new Bootique(args); }
/** * @return a Builder instance to configure the module before using it to * initialize DI container. * @since 0.12 */ public static Builder builder() { return new Builder(); }
/** * Returns an instance of {@link BQCoreModuleExtender} used by downstream modules to load custom extensions to the * Bootique core module. Should be invoked from a downstream Module's "configure" method. * * @param binder DI binder passed to the Module that invokes this method. * @return an instance of {@link BQCoreModuleExtender} that can be used to load custom extensions to the Bootique * core. * @since 0.22 */ public static BQCoreModuleExtender extend(Binder binder) { return new BQCoreModuleExtender(binder); }
/** * @param bootLogger custom BootLogger to use for a given runtime. * @return this instance of test runtime builder. * @since 0.23 */ public T bootLogger(BootLogger bootLogger) { bootique.bootLogger(bootLogger); return (T) this; }
/** * Adds a Module generated by the provider. Provider may optionally specify * that the Module overrides services in some other Module. * * @param moduleProvider a provider of Module and override spec. * @return this instance of test runtime builder. */ public T module(BQModuleProvider moduleProvider) { bootique.module(moduleProvider); return (T) this; }
/** * Appends extra values to the test CLI arguments. * * @param args extra args to pass to Bootique. * @return this instance of test runtime builder. */ public T args(String... args) { bootique.args(args); return (T) this; }
@Override public T with(Class<? extends Module> moduleType) { subBuilder.with(moduleType); return (T) BQTestRuntimeBuilder.this; }
/** * @param m a module to add to the test runtime. * @return this instance of test runtime builder. */ public T module(Module m) { bootique.module(m); return (T) this; }