public class GuiceyRunner
extends java.lang.Object
| Constructor and Description |
|---|
GuiceyRunner(ConfigurationContext context,
io.dropwizard.Configuration configuration,
io.dropwizard.setup.Environment environment) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Iterable<com.google.inject.Module> |
analyzeAndRepackageBindings()
If configuration from guice bindings is enabled, configured guice modules will be repackaged in order to
resolve all configured bindings (and filter disabled bindings to simulate common extensions disable behaviour).
|
com.google.inject.Injector |
createInjector(InjectorFactory injectorFactory,
java.lang.Iterable<com.google.inject.Module> modules) |
void |
injectCommands()
Inject fields in registered commands.
|
void |
installExtensions()
Execute extensions installation (by type and instance).
|
void |
prepareModules()
Prepare guice modules for injector creation.
|
void |
runBundles()
Process run phase for guicey bundles.
|
void |
runFinished()
Run lifecycle end.
|
public GuiceyRunner(ConfigurationContext context, io.dropwizard.Configuration configuration, io.dropwizard.setup.Environment environment)
public void runBundles()
GuiceBundle (or within it) will
be processed after that point (because they will be registered after guice bundle and so dropwizard will call
their run methods after guice bundle's run).public void prepareModules()
public java.lang.Iterable<com.google.inject.Module> analyzeAndRepackageBindings()
Note that analysis step use guice elements SPI, which guice will use in any case. And to avoid duplicate work on injector creation, analyzed elements are packaged into synthetic guice module and passed to injector instead of original modules.
After bindings analysis all extensions are finally registered and entire configuration info is finalized.
When bindings configuration is disabled (with
GuiceyOptions.AnalyzeGuiceModules), no modules repackaging is applied
(exact legacy guicey behavior). It may also be useful to disable feature to check for side effects.
public com.google.inject.Injector createInjector(InjectorFactory injectorFactory, java.lang.Iterable<com.google.inject.Module> modules)
injectorFactory - configured injector factorymodules - guice modules to use for injectorpublic void installExtensions()
public void injectCommands()
public void runFinished()