This content has been marked as final.
Show 6 replies
-
1. Re: Howto inject beans into a collection
alesj Feb 22, 2009 5:03 PM (in response to welle)Your example should work.
-
2. Re: Howto inject beans into a collection
welle Feb 23, 2009 2:54 AM (in response to welle)Hmm... Perhaps I should mention that I trying to get it to work under JBoiss AS 5.
It doesn't seem to recognize the "inject" within a "value" element:org.jboss.xb.binding.JBossXBRuntimeException: {urn:jboss:bean-deployer:2.0}inject not found as a child of {urn:jboss:bean-deployer:2.0}value
Here is my simple testclass Bpackage xxx.xxx.xxx; import java.util.List; public class B { private List actions = null; public void setActions(List actions) { this.actions = actions; } }
I also tried to create the bean within the "inject" without luck.bean name="a" class="xxx.xxx.A"> <property name="listOfB"> <list elementClass="xxx.xxx.B"> <value><bean name="b1" class="xxx.xxx.B">...</bean></value> </list> </property> </bean>
-
3. Re: Howto inject beans into a collection
welle Feb 23, 2009 2:55 AM (in response to welle)Oppss... The testclass should be is A not B...
-
4. Re: Howto inject beans into a collection
welle Feb 23, 2009 3:00 AM (in response to welle)...and the method "setActions" should be "setListOfB"...
-
5. Re: Howto inject beans into a collection
alesj Feb 23, 2009 5:06 AM (in response to welle)Try direct inject usage, w/o value.
-
6. Re: Howto inject beans into a collection
welle Feb 23, 2009 5:11 AM (in response to welle)That fixed it!
Thanks!
/Anders