使用spring管理事务的时候,配置文件的主意事项。
来源:互联网 发布:mac照片删除后 icloud 编辑:程序博客网 时间:2024/05/17 05:04
下面是一个使用spring管理事务的配置文件例子。注意红色部分
<?xml version="1.0" encoding="UTF-8"?>
<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"
default-autowire="byName" default-lazy-init="true">
<!-- Configure the Spring framework to use JTA transactions from Atomikos -->
<bean id="transactionManager1"
class="org.springframework.transaction.jta.JtaTransactionManager">
</bean>
<aop:aspectj-autoproxy proxy-target-class="true" />
<aop:config proxy-target-class="true">
<aop:advisor
pointcut="execution(* xxx.services.impls.* .*(..))"
advice-ref="txAdvice" />
</aop:config>
<tx:advice id="txAdvice" transaction-manager="transactionManager1">
<tx:attributes>
<tx:method name="get*" read-only="true"/>
<tx:method name="*" rollback-for="Exception"/>
</tx:attributes>
</tx:advice>
</beans>
default-autowire="byName" 如果有这个,那么
<bean id="transactionManager1"
class="org.springframework.transaction.jta.JtaTransactionManager">
</bean>
这个bean的id,一定不能是transactionManager否则会出错,原因是 org.springframework.transaction.jta.JtaTransactionManager这个类有属性也叫 transactionManager ,所以会造成错误。
- 使用spring管理事务的时候,配置文件的主意事项。
- ofstream 使用的一点主意事项
- IEnumerable<T> 的时候一个主意事项p
- 【重要】ViewPager的主意事项
- spring管理事务的配置文件
- 自定义TextView的一些主意事项
- 关于c++的入门小主意事项
- sizeof与strlen的主意事项
- 使用Spring的事务注解管理事务
- SQL Server不同版本之间发布订阅的主意事项
- 使用spring管理hibernate的事务
- Spring使用事务的时候需要注意的地方
- 使用spring AOP事务的时候报错的原因
- Spring 事务的管理
- spring hibernate整合时配置文件的事务部分(spring管理事务)
- Spring事务配置文件的分析
- Kernel的管理事项
- Weblogic启动失败以及Apache使用时候需要的事项。
- Address xx maps to localhost
- Oracle版本信息查询
- (转)UML中几种类间关系:继承、实现、依赖、关联、聚合、组合的联系与区别
- ssh中断while
- linux 下用eclipse 编写多线程C++项目
- 使用spring管理事务的时候,配置文件的主意事项。
- DataList使用笔记
- vc技巧杂文一
- 部署出错解决
- C#: GDI+双缓冲技术的使用
- ibatis +abator生成文件的问题(转)
- vc自定义消息的发送与接收的方法实现
- 使用COM组件实现对Excel文件的操控
- dom4j做xml的解析和输出