This seems to be a very simple questions, but I haven't been able to find a definitive answer in the Spring's manual,
1) Is there any guarantee that the container will load independent beans in the order they are declared in the XML file?
2) Are beans instantiated as well (both singleton and prototype) as soon as they are loaded by the container?
3) How does Spring container finds the dependencies between beans if they are not declared in order?
4) Are beans by default lazily-loaded by the BeanFactory? In that case the order wouldn't matter - isn't it?
5) When using "ClassPathXMLApplicationContext" to load multiple files, is the order we specify the xml files in the list important? That is, would the beans in the first xml file load before the others?
<bean id="server.context" class="org.springframework.context.support.ClassPa thXmlApplicationContext">
<constructor-arg>
<list>
<value>applicationContext-server-service.xml</value>
<value>applicationContext-manager.xml</value>
<value>applicationContext-client.xml</value>
</list>
</constructor-arg>
</bean>
</beans>
I want to make sure the beans are loaded in order. I can use Parent-Child beans relation, but want to see if the ClassPathXMLApplicationContext could work too.
Thanks.
1) Is there any guarantee that the container will load independent beans in the order they are declared in the XML file?
2) Are beans instantiated as well (both singleton and prototype) as soon as they are loaded by the container?
3) How does Spring container finds the dependencies between beans if they are not declared in order?
4) Are beans by default lazily-loaded by the BeanFactory? In that case the order wouldn't matter - isn't it?
5) When using "ClassPathXMLApplicationContext" to load multiple files, is the order we specify the xml files in the list important? That is, would the beans in the first xml file load before the others?
<bean id="server.context" class="org.springframework.context.support.ClassPa thXmlApplicationContext">
<constructor-arg>
<list>
<value>applicationContext-server-service.xml</value>
<value>applicationContext-manager.xml</value>
<value>applicationContext-client.xml</value>
</list>
</constructor-arg>
</bean>
</beans>
I want to make sure the beans are loaded in order. I can use Parent-Child beans relation, but want to see if the ClassPathXMLApplicationContext could work too.
Thanks.
Comment