this.instanceType = computeInstanceType(bean);
BeanLogger.LOG.createdContextInstance(bean, id);
}
public T getInstance() {
Container container = Container.instance(contextId);
if (bean == null) {
bean = container.services().get(ContextualStore.class).<Bean<T>, T>getContextual(id);
}
Context context = container.deploymentManager().getContext(bean.getScope());
T existingInstance = context.get(bean);
if (existingInstance != null) {
return existingInstance;
}
WeldCreationalContext<T> creationalContext;
WeldCreationalContext<?> previousCreationalContext = currentCreationalContext.get();
if (previousCreationalContext == null) {
creationalContext = new CreationalContextImpl<T>(bean);
} else {
creationalContext = previousCreationalContext.getCreationalContext(bean);
}
final CurrentInjectionPoint currentInjectionPoint = container.services().get(CurrentInjectionPoint.class);
currentCreationalContext.set(creationalContext);
try {
// Ensure that there is no injection point associated
currentInjectionPoint.push(EmptyInjectionPoint.INSTANCE);
return context.get(bean, creationalContext);