This content has been marked as final.
Show 3 replies
-
1. Re: Seam Injection Issue
ivan.indrawan Feb 3, 2010 1:51 PM (in response to pushpak1981)The way I do it is as follow: ComponentA is created first
@Name("ComponentA") @Scope(ScopeType.APPLICATION) @Startup public class ComponentA { String myProperty; @Create public void onCreate() { myProperty="blah"; } }
When ComponentB is created, the ComponentA is injected to B
@Name("ComponentB") @Scope(ScopeType.APPLICATION) @Startup @Install(depends="ComponentA") public class ComponentB { @In ComponentA a; @Create public void onCreate { System.out.println(a.getMyProperty()); } }
Hope it helps.
-
2. Re: Seam Injection Issue
pushpak1981 Feb 3, 2010 2:51 PM (in response to pushpak1981)Thanks for the reply. I tried executing the code but it gives me NullPointerException in componentB while accessing the getMyProperty.The ComponentA is not injected. We are using Seam 2.1.
-
3. Re: Seam Injection Issue
niox.nikospara.yahoo.com Feb 3, 2010 3:10 PM (in response to pushpak1981)Hi,
Did you try the Factory Components, as described in ch 4.8 of Seam 2.2.0 documentation?