public class DynamicClassProvider
extends java.lang.Object
implements com.google.inject.Provider<java.lang.Object>
@ProvidedBy(DynamicClassProvider.class)
and use it as usual guice bean.
Original bean will be correctly handled by guice aop: provider will generate new class, which guice could use for proxy generation.
If used with injectors hierarchy or within private modules, use together with
GeneratorAnchorModule to properly scope dynamic bindings.
Providers use guice package to use internal guice api (to resolve actual required type)
if you prefer direct registration in module| Constructor and Description |
|---|
DynamicClassProvider(com.google.inject.Injector injector) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
get() |
protected java.lang.Class<? extends java.lang.annotation.Annotation> |
getScopeAnnotation()
Override it to specify different annotation.
|
@Inject public DynamicClassProvider(com.google.inject.Injector injector)
public java.lang.Object get()
get in interface javax.inject.Provider<java.lang.Object>protected java.lang.Class<? extends java.lang.annotation.Annotation> getScopeAnnotation()