Description
Andreas Senft opened SPR-413 and commented
I just found out that there is a difference on using <ref bean="..."> or <ref local="...">, when accessing beans within the same configuration file.
If the referenced bean has only a name attribute and no id attribute it can be referenced via ref bean, but not via ref local.
Failing Example:
<bean id="Root" class="test.Root">
<property name="foo">
<ref local="Foo"/> <!-- ref bean will work -->
</property>
</bean>
<bean name="Foo" class="test.Foo">
</bean>
org.springframework.beans.factory.BeanDefinitionStoreException: Line 35 in XML document from class path resource [test.xml] is invalid; nested exception is org.xml.sax.SAXParseException: An element with the identifier "Foo" must appear in the document.
org.xml.sax.SAXParseException: An element with the identifier "Foo" must appear in the document.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:76)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:127)
at test.SpringTest.main(SpringTest.java:29)
Affects: 1.1.1