use of org.apache.webbeans.component.InjectionTargetBean in project tomee by apache.
the class BeanContext method inject.
@SuppressWarnings("unchecked")
public <T> void inject(final T instance, CreationalContext<T> ctx) {
final WebBeansContext webBeansContext = getWebBeansContext();
if (webBeansContext == null) {
return;
}
InjectionTargetBean<T> beanDefinition = get(CdiEjbBean.class);
if (beanDefinition == null) {
beanDefinition = InjectionTargetBean.class.cast(createConstructorInjectionBean(webBeansContext));
}
if (!(ctx instanceof CreationalContextImpl)) {
ctx = webBeansContext.getCreationalContextFactory().wrappedCreationalContext(ctx, beanDefinition);
}
beanDefinition.getInjectionTarget().inject(instance, ctx);
}
Aggregations