-
1. Re: Injection and disinjection control
gavin.king Nov 26, 2006 3:11 PM (in response to msystems)There is a way, namely that you can use "configuration" instead of bijection. ie.
<component name="b"> <property name="var">#{a}</property> </component>
However, it sounds to me like you are trying to preoptimize. A few hundred calls of a setter method is totally insignificant compared to the other costs involved (database access, rendering the view, etc). -
2. Re: Injection and disinjection control
spambob Nov 30, 2006 6:26 PM (in response to msystems)Could you please elaborate a bit why injection is happening for every method call instead of only 1 time on the 1st call.
I'm asking because I thought that configuration with xml or with annotations leads to the same result.
Further, if i declare a request scoped bean I expect it to be there and exactly the same for the whole life cycle of the request - therefore it would be less preoptimization than avoidance of unnecessary work.
The only reason i first could have thought of was because of some object caching / pooling issues but as this has to work for annotation configured stuff too it can't be the reason.
So please elaborate / clarify this a bit.
Thanks in advance -
3. Re: Injection and disinjection control
gavin.king Nov 30, 2006 7:36 PM (in response to msystems)Could you please elaborate a bit why injection is happening for every method call instead of only 1 time on the 1st call.
Because the value of a contextual variable can change b/w calls.I'm asking because I thought that configuration with xml or with annotations leads to the same result.
It definitely does not, and the docs make this very clear.
Stop pre-optimizing! The FIRST rule of performance is don't make assumptions about performance before you actually have a real application which has a performance problem. This is a basic rule that all good programmers follow. Seam's bijection is NOT going to make your fast application slow! -
4. Re: Injection and disinjection control
igorla Jan 10, 2007 5:48 AM (in response to msystems)Is it possible to config injection in such way that injection will be done only on instance create?
Consider the following code:
class A{
@In
B b;
C c;
public getC(){..}
}
class C{
A a;
public getName(){
a.getB().getName();
}
}
in .xhtml file present the following reference:
#{a.c.name}
What happens: C.getName is called - A instance doesn't have anymore reference to B due to disinjection after call A.getC() -> NPE is thrown.
The code above is simplified and making C as component is not desirable.
Probably this code is too much coupled, but it doesn't break any Java rules.