I found the following behavior of Spring framework but I didn't manage to find corresponding official documentation explaining it.
Let's say we have 2 file A.xml & B.xml. A.xml imports B.xml and both of them contain beans with the same name, i.e:
<bean id="testBeanName" class="TestClassA"/>
When I load the configuration and tell ApplicationContext get me the bean with name "testBeanName" it will return me one from A.xml file. It's kind of shadowing. Is it a side effect of some bean name resolving mechanism or it's a feature provided by Spring? Are there any guaranties that ApplicationContext will always return me the bean defined in the 'top-level' xml file? And where can I read about that?
<bean id="testBeanName" class="TestClassB"/>
Thank you in advance.