public enum GuiceyOptions extends java.lang.Enum<GuiceyOptions> implements Option
GuiceBundle.Builder
. Direct option definition
may be useful when option is dynamically resolved and so shortcut methods can't be used (will require builder
flow interruption and additional if statements).
Normally options are mostly useful for runtime configuration values access (e.g. check in some 3rd party bundle what packages are configured for classpath scan).
Generally options are not limited to this enum and custom option enums may be used by 3rd party bundles.
for details
,
for usage in guice services
,
for reporting
Enum Constant and Description |
---|
BindConfigurationByPath
Introspect configuration object (using jackson serialization) and bind all internal values by path
(
@Inject @Config("path.to.value") Integer value ). |
BindConfigurationInterfaces
Deprecated.
remains for compatibility, instead bind configuration interfaces with
@Config qualifier |
ConfigureFromDropwizardBundles
Recognize
GuiceyBundle from installed
dropwizard bundles. |
GuiceFilterRegistration
GuiceFilter registered for both contexts (application and admin) to provide guice
ServletModule support and allow using request and session scopes. |
InjectorStage
Guice injector stage used for injector creation.
|
ScanPackages
Packages for classpath scan.
|
SearchCommands
Enables commands search in classpath and dynamic installation.
|
UseCoreInstallers
Automatic core installers
installation.
|
UseHkBridge
Enables guice bridge for HK2 to allow HK2 services to see guice beans.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getDefaultValue() |
java.lang.Class<?> |
getType() |
static GuiceyOptions |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static GuiceyOptions[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final GuiceyOptions ScanPackages
public static final GuiceyOptions SearchCommands
GuiceBundle.Builder.searchCommands()
public static final GuiceyOptions UseCoreInstallers
public static final GuiceyOptions ConfigureFromDropwizardBundles
GuiceyBundle
from installed
dropwizard bundles.
Disabled by default.@Deprecated public static final GuiceyOptions BindConfigurationInterfaces
@Config
qualifier
Note: interfaces are always bound with qualifier: @Inject @Config ConfInterface config
.
Option only controls if extra binding must be done without qualifier.
public static final GuiceyOptions BindConfigurationByPath
@Inject @Config("path.to.value") Integer value
). Recognize unique sub configuration objects
for direct binding (@Inject @Config SubConfig conf
). Enabled by default.
Note that path could be hidden using JsonIgnore
on property getter.
Option exists only for edge cases when introspection fails and prevents application startup (should be
impossible) or due to project specific reasons (when internal bindings are not desirable). When
disabled, only configuration object itself would be bound (by all classes in hierarchy and interfaces).
Note that ConfigurationTree
will also not contain paths - option
disables entire introspection process.
ConfigTreeBuilder
,
ConfigurationTree
,
ConfigBindingModule
public static final GuiceyOptions InjectorStage
GuiceBundle.Builder.build(Stage)
public static final GuiceyOptions GuiceFilterRegistration
ServletModule
support and allow using request and session scopes.
By default, filter is registered only for direct requests.
Declare other types if required (but note that GuiceFilter does not support ASYNC!).
To disable guice filter installation use empty set: EnumSet.noneOf(DispatcherType.class)
.
This will completely disable guice servlet modules support because without guice filter, guice web support
is useless (all filters and servlets registered in servlet module are dispatched by guice filter).
Note that even without guice servlet modules support HttpServletRequest and HttpServletResponse objects will be
still available for injection in resources (through HK2 bridging). Also, note that guice servlets initialization
took some time and application starts faster without it (~50ms). Use
WebInstallersBundle
to register guice manged servlets
and filters.
IMPORTANT: after disabling guice filter, servlet and request scopes will no longer be available and
installation of guice ServletModule will be impossible (will fail on duplicate binding).
Also it will not be possible to use http request and response injections under filter and servlets
(it will work only with resources).
public static final GuiceyOptions UseHkBridge
HK2Managed
used to properly instantiate
service by HK2 when it also depends on guice services.
IMPORTANT: requires extra dependency on HK2 guice-bridge: 'org.glassfish.hk2:guice-bridge:2.5.0-b32'
public static GuiceyOptions[] values()
for (GuiceyOptions c : GuiceyOptions.values()) System.out.println(c);
public static GuiceyOptions valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic java.lang.Class<?> getType()
public java.lang.Object getDefaultValue()
getDefaultValue
in interface Option