Annotation Type JerseyManaged
-
@Target(TYPE) @Retention(RUNTIME) @Deprecated public @interface JerseyManaged
Deprecated.in the next version HK2 support will be removed and annotation will become uselessAnnotate jersey extension to delegate bean creation into HK2.Works for extensions registered by
JerseyInstaller
.Guice context is started before HK2, but HK2 related bindings (using service locator instance) will appear in guice context only after HK2 context creation. So if bean directly depends on HK2 services (dependencies can't be wrapped with
Provider
, there is no way to properly create it in guice context.Good examples for this are
AbstractValueParamProvider
andParamInjectionResolver
. Both are required to implement new parameter annotation and both will start immediately in HK2 context.Still guice bindings could be used in HK2 managed bean (especially other extensions, installed by
JerseyProviderInstaller
. In case of problems with lifecycle, simply useProvider
to wrap actual binding and delay it's resolution.In fact, using this annotation is the same as registering bean directly in jersey. Installer just simplifies binder definition to simple annotation.
Annotation will do nothing if HK2-first mode enabled:
InstallersOptions.JerseyExtensionsManagedByGuice
- Since:
- 21.11.2014
- See Also:
as alternative solution
,GuiceManaged