在Spring的配置事务的过程中,出现如下错误,Configuration problem: Cannot locate BeanDefinitionDecorator for element [advice]请大家给帮帮忙,自己不知道是为什么?
出问题的Spring配置文件如下: 
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"                                   
xsi:schemaLocation="
http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd" >
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:hibernate.cfg.xml </value>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED"/>
<tx:method name="del*" propagation="REQUIRED"/>
<tx:method name="modify*" propagation="REQUIRED"/><tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="allManagerMethod" expression="execution(* edu.ysu.usermgr.manager.*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod"/>
</aop:config></bean>
</beans>不知道问题说清楚没有,如果没有说明白,请大家给个提示。

解决方案 »

  1.   

    提示好像是“不能定位advice配置的封装”
      

  2.   

    低级错误,检查下第二个bean的设置,
      

  3.   

    <!-- 配置哪些类的方法需要进行事务管理 -->
    <aop:config>
    <aop:advisor pointcut="execution(* *..CcamsService.*(..))" advice-ref="txAdvice"/>
    </aop:config>
    <!-- 配置事务特性 -->
    <tx:advice id="txAdvice">
    <tx:attributes>
    <tx:method name="insert*"/>
    <tx:method name="update*"/>
     <tx:method name="del*"/>
    <tx:method name="*" read-only="true"/>
    </tx:attributes>
    </tx:advice>
      

  4.   

    <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> 
    <property name="sessionFactory"> 
    <ref bean="sessionFactory"/> 
    </property> 需加上
    </bean>