spring 事务管理配置文件报错
报错信息:thematchingwildcardisstrit,butnodeclationcanbefoundforelement"tx:advise"三个都是这样<b...
报错信息:the matching wildcard is strit,but no declation can be found for element"tx:advise"
三个都是这样
<beans xmlns:a="http://www.springframework.org/schema/aop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
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/spring-tx-2.0.xsd
">这是所有的命名空间 展开
三个都是这样
<beans xmlns:a="http://www.springframework.org/schema/aop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
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/spring-tx-2.0.xsd
">这是所有的命名空间 展开
1个回答
展开全部
首先的在最上面加上aop和tx 命名空间
<!-- 配置hibernate事务管理器 -->
<bean id="TransManger" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<!-- 配置事务特性 -->
<tx:advice id="Transtx" transaction-manager="TransManger">
<tx:attributes>
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="find*" propagation="REQUIRED"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>
<!-- 使用aop 注入 -->
<aop:config>
<aop:pointcut id="pService" expression="execution(* com.qdc.service.*.*.*(..))"/>
<aop:advisor advice-ref="Transtx" pointcut-ref="pService"/>
</aop:config>
<!-- 配置hibernate事务管理器 -->
<bean id="TransManger" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<!-- 配置事务特性 -->
<tx:advice id="Transtx" transaction-manager="TransManger">
<tx:attributes>
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="find*" propagation="REQUIRED"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>
<!-- 使用aop 注入 -->
<aop:config>
<aop:pointcut id="pService" expression="execution(* com.qdc.service.*.*.*(..))"/>
<aop:advisor advice-ref="Transtx" pointcut-ref="pService"/>
</aop:config>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询