@Target(value=TYPE)
@Retention(value=RUNTIME)
public @interface HK2Managed
Works for extensions registered by
JerseyInstaller
.
Guice context is started before HK, but HK related bindings (using service locator instance) will appear
in guice context only after HK context creation. So if bean directly depends on HK services
(dependencies can't be wrapped with Provider
, there is no way to properly create
it in guice context.
Good examples for this are AbstractValueFactoryProvider
and ParamInjectionResolver
. Both are required to implement
new parameter annotation and both will start immediately in HK context.
Still guice bindings could be used in hk managed bean (especially other extensions, installed by
JerseyProviderInstaller
.
In case of problems with lifecycle, simply use Provider
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.
as alternative solution