I sent an explanation about this but I did not find it. Anyway, as I remember I
added this for finding instances of bean from creational context stack.
For example lets say that A --> B --> C and A injects B, B injects C and C
injects A
When C injects A it finds A over backtrace using B.stack --> A.stack. A.stack
is owner creational context of B.stack.
Important point in circular injections is that there are two points in circular
injections
1* Injection of instance
2* Calling injected instance method in injecting bean : Injecting bean may call
injected instance method. For example, it can be occur on circular injection
over producer methods.
A{
B b;
}
//Adds incomplete instance A into creational context
C{
@Produces B getB(A a) --> A proxy
{
a.someMethod(); -->Interceptor handler gets incomplete A to call
interceptor methods.
}
}
For calling interceptor on injected instance, you have to inject bean proxy as
an injected instance into injecting bean. But InterceptorHandler tries to find
actual instance, therefore you have to also push(incomplete instance) in
AbstractInjectionTargetBean#createDefaultInstance.
--Gurkan
________________________________
From: Mark Struberg <[email protected]>
To: [email protected]
Sent: Sun, February 21, 2010 10:45:07 PM
Subject: OwnerCreational question
Hi!
Gurkan, I don't really understand why we need all the OwnerCreational stuff.
The spec doesn't say anything and as mentioned in an old discussion there are
imo only 2 things we need the CreationalContext at all:
1.) for providing a really shortly timed storage while creating dependent
contextual instances with circular dependencies. In this situation we use the
push() to store 'incomplete' instances and after the instance got created
(basically after the constructor) it's of no use any longer.
(Btw, I think one single 'incompleteInstance' is not enough and we have to
somehow support a List)
2.) information about depedent contextual instances (and NO contextual
references!) will be collected so we can destroy them after the bean where they
got injected into has reached its end of life.
I also found a few issues in our current implementation
a) we currently also store system things like the BeanManager and Event sources
as dependent object. This feels really wrong!
b) we must not store instances which get injected via a proxy. A contextual
reference is not a dependent contextual instance.
I'm not really sure why we need the OwnerCreationalContext.
Either we have a dependent bean or the owner has it. But a dependent contextual
instance is per definition not injectable into 2 instances.
Please help me, I'm a bit brain overloaded today already :)
LieGrue,
strub
__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen
Massenmails.
http://mail.yahoo.com
___________________________________________________________________
Yahoo! Türkiye açıldı! http://yahoo.com.tr
İnternet üzerindeki en iyi içeriği Yahoo! Türkiye sizlere sunuyor!