|
From: Juergen H. <ju...@in...> - 2005-01-07 15:34:25
|
Beans that are supposed to be available for references by name indeed need to be defined at the root level. Inner beans are always anonymous and usually don't carry a name. Defining a name for them only adds value if they are aware of their own name (BeanNameAware). Juergen -----Original Message----- From: spr...@li... [mailto:spr...@li...]On Behalf Of Steven Devijver Sent: Friday, January 07, 2005 4:23 PM To: spr...@li... Subject: [Springframework-developer] bean factory scope question Hi, When I load the application context with the example below I get an exception because a bean with id "test3" cannot be found. I understand this bean does not exist in the scope where it's referenced. Is there a way to make beans with an id or name available in the root scope apart from defining them there? <bean id="test2" class="sandbox.TestObject"> <property name="value"> <list> <bean class="sandbox.TestObject"> <property name="value"> <value>a string</value> </property> </bean> <bean class="sandbox.TestObject"> <property name="value"> <list> <bean id="test3" class="sandbox.TestObject"> <property name="value"> <value>another string</value> </property> </bean> </list> </property> </bean> <bean class="sandbox.TestObject"> <property name="value"> <list> <ref bean="test3"/> </list> </property> </bean> </list> </property> </bean> Steven ------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |