It is possible to use more than one config file, but I haven't figured out what the logic is for handling beans with the same ID. Does it pick the first bean identified by the ID, the last one, or one at random?
Here is an example. I have a bean with an ID of "dataSource in hibernate.xml. I would like to override it with the "dataSource" bean in dataSource.xml. How would I do that? Should either of these work?
orCode:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean id="configs" class="org.springframework.context.support.ClassPathXmlApplicationContext"> <constructor-arg> <list> <value>dataSource.xml</value> <value>hibernate.xml</value> </list> </constructor-arg> </bean> </beans>
I'm using Spring v1.1.3. Any ideas?Code:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean id="dataSourceConfig" class="org.springframework.context.support.ClassPathXmlApplicationContext"> <constructor-arg> <list> <value>dataSource.xml</value> </list> </constructor-arg> </bean> <bean id="configs" class="org.springframework.context.support.ClassPathXmlApplicationContext"> <constructor-arg> <list> <value>hibernate.xml</value> </list> </constructor-arg> <constructor-arg> <ref local="dataSourceConfig"/> </constructor-arg> </bean> </beans>
Cameron


Reply With Quote