Description
Colin Sampaleanu opened SPR-2285 and commented
The bean factory and application context contract clearly states (as per our docs) that within one definition xml file a bean id must be unique.
This is enforced by the XML parser when using the "id" attribute exclusively because this is flagged as an XML IDREF attribute. However, by combining the use of the id attribute and the name attribute, or just using the name attribute exclusively, it is possible to have 2 or more bean definitions in the same xml file with the same id. This is silently accepted with the last bean definition winning out.
The bean definition reader must basically track ids, however they are supplied, and enforce the same semantics from usage of the "name" attribute as from usage of the "id" attribute.
A related question is what should happen in the case of <import>? An argument could be made either way here.
Affects: 2.0 RC2
Attachments:
- spring2285_testcase_and_patch.zip (2.67 kB)