我在config.xml中..
<bean id="helloController" class="net.ali.web.HelloController">
           <property name="viewName">  
                 <value>hello</value>
           </property>
            <property name="userDao">
                 <ref bean="userDAOProxy" />  <!-- 注入一个bean(定义在Hibernate的配置文件里) -->
           </property>
</bean>
注入一个叫userDAOProxy的bean..该bean在applicationContext.xml中定义的..如下
<bean id="userDAOProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> 
 
   <property name="transactionManager"> 
     <ref bean="transactionManager" /> 
   </property> 
 
   <property name="target"> 
     <ref local="userDao" />
   </property> 
 
   <property name="transactionAttributes"> 
     <props> 
       <prop key="insert*">PROPAGATION_REQUIRED</prop> 
       <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> 
     </props> 
       </property> 
  </bean> 
可是报Cannot resolve reference to bean 'userDAOProxy' while setting bean property 'userDao'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'userDAOProxy' is defined找不到bean错误..
各位大虾帮帮忙..

解决方案 »

  1.   

    在applicationContext.xml中你要把config.xml包含进来.这样就OK了.或者在config.xml中把applicationContext.xml包含进来.
      

  2.   

    要 引用其他的 配置文件的bean就要 引用其他配置文件用
    <import resource="xxxx.xml"/> 把相应的文件引入
      

  3.   

    哈哈..加入<import resource="xxxx.xml"/>就可以了..多谢了..
    我分数不多,全给你们了..不要嫌少咯..