[jboss-user] [JBoss Seam] - Re: Injection and disinjection control

igorla do-not-reply at jboss.com
Wed Jan 10 05:48:49 EST 2007


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.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3999835#3999835

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3999835



More information about the jboss-user mailing list