frankChan
Oct 31st, 2004, 10:02 AM
I've just started using Spring and I am trying to wire up a few beans. I have a bean in an applicationContext.xml that is referenced in my springapp-servlet.xml file.
I get the error
Error creating bean with name 'springAppController' defined in resource [/WEB-INF/springapp-servlet.xml
] of ServletContext: Can't resolve reference to bean 'someBeanManager' while sett
ing property
Do I have to do anything specific in code or in a file to allow the xx-servlet.xml file and the contextLoader to get the beans from the applicationContext.xml?
THis is the definition in my applicationContext.xml
<bean id="someBeanDAO" class="com.test.dao.SomeBeanDaoImpl">
<property name="sessionFactory"><ref local="sessionFactory"/></property>
</bean>
<bean id="someBeanManager" class="org.springframework.transaction.interceptor.Transa ctionProxyFactoryBean">
<property name="transactionManager"><ref local="transactionManager"/></property>
<property name="target"><ref local="someBeanDAO"/></property>
<property name="transactionAttributes">
<props>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="store*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
And in my springapp-servlet.xml I have
<bean id="springAppController" class="com.test.web.SpringAppController">
<property name="someBeanManager"><ref bean="packageManager"/></property>
</bean>
I get the error
Error creating bean with name 'springAppController' defined in resource [/WEB-INF/springapp-servlet.xml
] of ServletContext: Can't resolve reference to bean 'someBeanManager' while sett
ing property
Do I have to do anything specific in code or in a file to allow the xx-servlet.xml file and the contextLoader to get the beans from the applicationContext.xml?
THis is the definition in my applicationContext.xml
<bean id="someBeanDAO" class="com.test.dao.SomeBeanDaoImpl">
<property name="sessionFactory"><ref local="sessionFactory"/></property>
</bean>
<bean id="someBeanManager" class="org.springframework.transaction.interceptor.Transa ctionProxyFactoryBean">
<property name="transactionManager"><ref local="transactionManager"/></property>
<property name="target"><ref local="someBeanDAO"/></property>
<property name="transactionAttributes">
<props>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="store*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
And in my springapp-servlet.xml I have
<bean id="springAppController" class="com.test.web.SpringAppController">
<property name="someBeanManager"><ref bean="packageManager"/></property>
</bean>