PDA

View Full Version : Why specify id with parent attribute in inner beans?



hucmuc
Oct 21st, 2004, 01:15 PM
I have following when defining a constructor of a bean:



<constructor-arg>
<bean id="sf1" parent="default.sessionFactory">
<property name="dataSource">
<bean class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>java&#58;comp/env/jdbc/ds</value>
</property>
</bean>
</property>
</bean>
</constructor-arg>


Why am I forced to name my bean (i'm calling it sf1).

However, if I don't use the parent and define the whole bean then I don't need to specify the id (ids for inner beans are meaningless).

I would like to treat these "inner beans" like annoymous classes where I don't need to specify ids since it should only exist in the inner portion of definition (i.e sf1 should never be accessible anywhere else).

dino

Colin Sampaleanu
Oct 23rd, 2004, 07:57 AM
Are you saying you're getting an error if you don't define the id ("sf1" in this case?). That shouldn't be the case. I would file a bug report if that's happening...

hucmuc
Oct 23rd, 2004, 09:52 AM
Hopefully, today I will write a small app with an xml file to reproduce this problem and submit a bug report.

DIno

hucmuc
Oct 23rd, 2004, 02:04 PM
How do I report this as a bug?

dino

Colin Sampaleanu
Oct 23rd, 2004, 03:47 PM
In Spring's Jira instance:

http://opensource.atlassian.com/projects/spring/secure/Dashboard.jspa

Thanks,