spring配置SessionFactory ,transactionManager以及其他特性
2013-05-14 11:37
405 查看
<?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"> <!-- 配置SessionFactory --> <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> </bean> <!-- 哪些类哪些方法使用事务 --> <aop:config> <aop:pointcut id="allServiceMethod" expression="execution(* com.archermind.service.*.*(..))" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="allServiceMethod" /> </aop:config> <!-- 事务的传播特性 --> <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="*" propagation="REQUIRED" read-only="true" /> </tx:attributes> </tx:advice> </beans>
相关文章推荐
- spring配置SessionFactory ,transactionManager以及其他特性
- spring配置SessionFactory ,transactionManager以及其他特性
- spring配置SessionFactory ,transactionManager以及其他特性
- 事务有哪些特性?spring的事务管理有几种方式实现,如何实现?spring 中常用的两种事务配置方式以及事务的传播性、隔离级别
- Spring AOP基于注解的“零配置”方式实现以及一些其他知识点
- Spring中多配置文件以及寻觅引用其他bean的方式
- Spring学习03--其他特性(减少配置、自动装配、scope作用域,延迟初始化)
- Spring中多配置文件以及寻觅引用其他bean的方式
- Atitit.mybatis的测试 以及spring与mybatis在本项目中的集成配置说明
- Spring基础特性总结二 --- 核心组件Core以及Resource的设计
- Druid连接池以及在springboot下配置
- ubuntu下如何方便快捷的配置java环境以及其他的一些个人配置
- Spring中引入其他配置文件
- Spring的事务ACID特性、隔离级别以及传播行为
- spring 配置事务传播特性
- 使用Spring3.2.0+Hibernate3.2.2+Struts2 2.2.3整合小demo以及配置使用的jar包集合
- spring配置中,properties文件以及xml文件配置问题
- Java Servlet + Spring 配置中所遇问题以及处理
- 使用spring注解 自动装配以及自动扫描机制 实现零xml配置的前提
- Spring学习----------AOP以及Spring配置文件详解