T
- configuration typepublic static class GuiceBundle.Builder<T extends io.dropwizard.Configuration>
extends java.lang.Object
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
GuiceBundle<T> |
build() |
GuiceBundle<T> |
build(com.google.inject.Stage stage) |
GuiceBundle.Builder<T> |
bundles(GuiceyBundle... bundles)
Guicey bundles are mainly useful for extensions (to group installers and extensions installation without
auto scan).
|
GuiceBundle.Builder<T> |
configureFromDropwizardBundles(boolean enable)
If enabled registered dropwizard bundles are checked if they implement
GuiceyBundle and called
to configure guice. |
GuiceBundle.Builder<T> |
disableInstallers(java.lang.Class<? extends FeatureInstaller>... installers) |
GuiceBundle.Builder<T> |
enableAutoConfig(java.lang.String... basePackages)
Enables auto scan feature.
|
GuiceBundle.Builder<T> |
extensions(java.lang.Class<?>... extensionClasses)
Beans could be registered automatically when auto scan enabled,
but if you don't want to use it, you can register beans manually.
|
GuiceBundle.Builder<T> |
injectorFactory(InjectorFactory injectorFactory)
Configures custom
InjectorFactory . |
GuiceBundle.Builder<T> |
installers(java.lang.Class<? extends FeatureInstaller>... installers)
Feature installers registered automatically when auto scan enabled,
but if you don't want to use it, you can register installers manually (note: without auto scan default
installers will not be registered).
|
GuiceBundle.Builder<T> |
modules(com.google.inject.Module... modules)
NOTE: if module implements *AwareModule interfaces, objects will be set just before configuration start.
|
GuiceBundle.Builder<T> |
searchCommands(boolean searchCommands)
NOTE: will not scan if auto scan not enabled (packages not configured).
|
public GuiceBundle.Builder<T> injectorFactory(InjectorFactory injectorFactory)
InjectorFactory
. Required by some guice extensions like governator.injectorFactory
- custom guice injector factorypublic GuiceBundle.Builder<T> enableAutoConfig(java.lang.String... basePackages)
basePackages
- packages to scan extensions inpublic GuiceBundle.Builder<T> modules(com.google.inject.Module... modules)
modules
- one or more juice modulesBootstrapAwareModule
,
ConfigurationAwareModule
,
EnvironmentAwareModule
,
DropwizardAwareModule
public GuiceBundle.Builder<T> searchCommands(boolean searchCommands)
searchCommands
- true to enable class path scanning for commands, false to disable (default)@SafeVarargs public final GuiceBundle.Builder<T> disableInstallers(java.lang.Class<? extends FeatureInstaller>... installers)
installers
- feature installer types to disable@SafeVarargs public final GuiceBundle.Builder<T> installers(java.lang.Class<? extends FeatureInstaller>... installers)
Also, could be used to add installers from packages not included in auto scanning.
installers
- feature installer classes to registerpublic GuiceBundle.Builder<T> extensions(java.lang.Class<?>... extensionClasses)
Guice injector will instantiate beans and registered installers will be used to recognize and properly register provided extension beans.
Also, could be used to add beans from packages not included in auto scanning.
NOTE: startup will fail if bean not recognized by installers.
NOTE: Don't register commands here: either enable auto scan, which will install commands automatically or register command directly to bootstrap object and dependencies will be injected to them after injector creation.
extensionClasses
- extension bean classes to registerpublic GuiceBundle.Builder<T> bundles(GuiceyBundle... bundles)
Its also possible to use dropwizard bundles as guicey bundles: bundle must implement
GuiceyBundle
and configureFromDropwizardBundles(boolean)
must be enabled
(disabled by default). This allows using dropwizard bundles as universal extension point.
bundles
- guicey bundlespublic GuiceBundle.Builder<T> configureFromDropwizardBundles(boolean enable)
GuiceyBundle
and called
to configure guice. This allows using dropwizard bundles as universal extension point.
Disabled by default.
enable
- true to enable configuration from dropwizard bundlespublic GuiceBundle<T> build(com.google.inject.Stage stage)
stage
- stage to run injector withpublic GuiceBundle<T> build()