PDA

View Full Version : Referencing bean in other XML file



pearsons_11114
Oct 20th, 2004, 08:40 PM
I have two configuration files, applicationContext.xml and dispatcher-servlet.xml. I'm referencing a bean defined in one file from the other. I'm using the "ref bean=" syntax (not local). Anything else I need to do to get this to work? The stack trace is telling me that it can't resolve the reference and then listing out all the bean names defined locally (as if that is the only place it's looking).

applicationContext.xml
<bean id="bean1" class="...
</bean>

dispatcher-servlet.xml:
<bean id="bean2" class="...
<property name="b1"><ref bean="bean1"/></property>
</bean>

irbouho
Oct 20th, 2004, 08:46 PM
how do you load your applicationContext.xml?

pearsons_11114
Oct 20th, 2004, 09:31 PM
Well, I'm not. And that just could be the problem. ;-) Seriously, your question pointed me to the right part of the doc to review. thanks.