* necessarily be done within the ProxyResolver resolve operation since this provider operation
* relies on a bean which is not yet available.
*/
ctx.recordCycle(inj.getEnclosingType(), injectableInstance.getEnclosingType());
final AsyncProxyInjector proxyInject = getOrCreateProxy(ctx, inj.getEnclosingType(), qualifyingMetadata);
boolean pushedProxy = false;
try {
if (injectableInstance.getTaskType() == TaskType.Parameter
&& injectableInstance.getConstructor() != null) {
// eek! a producer element is produced by this bean and injected into it's own constructor!
final AsyncProxyInjector producedElementProxy
= getOrCreateProxy(ctx, inj.getInjectedType(), qualifyingMetadata);
for (final AsyncInjectorResolveCallback cb : callbacks) {
cb.onResolved(producedElementProxy);
}
return producedElementProxy.getBeanInstance(injectableInstance);
}
else {
ctx.getProcessingContext().pushBlockBuilder(proxyInject.getProxyResolverBlockBuilder());
pushedProxy = true;
ctx.markOpenProxy();
for (final AsyncInjectorResolveCallback cb : callbacks) {
cb.onResolved(proxyInject);
}
return proxyInject.getBeanInstance(injectableInstance);
}
}
finally {
if (!ctx.isProxyOpen() && pushedProxy) {
ctx.getProcessingContext().popBlockBuilder();
}
}
}
else if (inj.isSoftDisabled()
|| (inj.isDependent() &&
(!alwaysProxyDependent || !ctx.typeContainsGraphCycles(inj.getInjectedType())))) {
inj.setEnabled(true);
if (inj.isCreated() && !inj.isRendered()) {
throw new InjectionFailure("unresolveable cycle on dependent scoped bean: "
+ inj.getInjectedType().getFullyQualifiedName() + "; does the bean intersect with a normal scope?");
}
for (final AsyncInjectorResolveCallback cb : callbacks) {
cb.onResolved(inj);
}
return inj.getBeanInstance(injectableInstance);
}
}
}
catch (InjectionFailure e) {
e.printStackTrace();
}
if (!ctx.isTypeInjectable(clazz)) {
ctx.recordCycle(clazz, injectableInstance.getEnclosingType());
final AsyncProxyInjector proxyInject = getOrCreateProxy(ctx, clazz, qualifyingMetadata);
for (final AsyncInjectorResolveCallback cb : callbacks) {
cb.onResolved(proxyInject);
}
return proxyInject.getBeanInstance(injectableInstance);
}
else {
throw new InjectionFailure("cannot resolve injectable bean for type: " + clazz.getFullyQualifiedName()
+ "; qualified by: " + qualifyingMetadata.toString());
}