T
- configuration typepublic final class GuiceBundle<T extends io.dropwizard.Configuration>
extends java.lang.Object
implements io.dropwizard.ConfiguredBundle<T>
ConfigurationAwareModule
).
You can use auto scan to automatically install features. To enable auto scan you must configure package (or
packages) to search in. To know all supported features look
FeatureInstaller
implementations. Installers are
expendable mechanism: they are resolved by scanning classpath, so you can add new installers in your code and
classpath scanning will find them and activate. Also, features could be disabled (for example, if you want to
replace existing feature, you will disable it in builder and implement your own - auto scan will find it and
activate).
Any class may be hidden from auto scanning with @InvisibleForScanner
annotation.
Commands may use injection too, but only fields injection. You can register command manually and their fields will be injected or you can activate auto scan for commands in builder (disabled by default). If auto scan for commands enabled, they will be instantiated with default no-arg constructor.
Resources are registered using jersey integration module. GuiceFilter is also registered.
Lifecycle:Project is based on ideas from dropwizard-guice project
. And because of this project name was changed to dropwizard-guicey.Modifier and Type | Class and Description |
---|---|
static class |
GuiceBundle.Builder<T extends io.dropwizard.Configuration>
Builder encapsulates bundle configuration options.
|
Modifier and Type | Method and Description |
---|---|
static <T extends io.dropwizard.Configuration> |
builder() |
com.google.inject.Injector |
getInjector() |
void |
initialize(io.dropwizard.setup.Bootstrap bootstrap) |
void |
run(T configuration,
io.dropwizard.setup.Environment environment) |
public void initialize(io.dropwizard.setup.Bootstrap bootstrap)
initialize
in interface io.dropwizard.ConfiguredBundle<T extends io.dropwizard.Configuration>
public void run(T configuration, io.dropwizard.setup.Environment environment) throws java.lang.Exception
run
in interface io.dropwizard.ConfiguredBundle<T extends io.dropwizard.Configuration>
java.lang.Exception
public com.google.inject.Injector getInjector()
public static <T extends io.dropwizard.Configuration> GuiceBundle.Builder<T> builder()
T
- configuration type