spring follows the order you specify in the list. The elements in the list will be exactly the elements [elem1, elem2, elem3, elem4], as you indicated. Otherwise, you are doing something wrong, can you show code that prints a different order to you?
However, the order of initialization of the bean may be different and depends on the dependencies of the bean, therefore, for example, if you have two beans
<bean id="holder" class="my.HolderBean" lazy-init="false"> <property name="inner" ref="inner"/> </bean> <bean id="inner" class="my.InnerBean" lazy-init="false"/>
Then, regardless of the xml definition order, an InnerBean will be initialized first, then during HolderBean initialization it will be inserted into the HolderBean.
source share