您的位置:首页 > 编程语言 > Java开发

Spring事务配置

2016-05-31 00:00 423 查看
摘要: spring和mybatis事务配置

<bean name="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>

<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="insert*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="select*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>

<aop:config >
<aop:pointcut id="allserviceMethod"  expression="execution(* com.hrm.service.*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="allserviceMethod"/>
</aop:config>

遇到的异常
execution括号中第一个*号后需加空格,不加空格会报错
Caused by: java.lang.IllegalArgumentException: Pointcut is not well-formed:
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息