Spring Action TransactionManager
来源:互联网 发布:软件开发阶段划分 编辑:程序博客网 时间:2024/05/16 06:24
<?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:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/" p:suffix=".jsp" />
<bean id="paramMethodResolver" p:paramName="action" class="org.springframework.web.servlet.mvc.multiaction.ParameterMethodNameResolver"/>
<bean id="sessionFactory1" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation" value="classpath:hibernate.cfg.xml"/>
</bean>
<bean id="sessionFactory2" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation" value="classpath:hibernate5.cfg.xml"/>
</bean>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory1"/>
</bean>
<bean id="hibernateTemplate2" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory2"/>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory1"/>
</bean>
<!-- <tx:annotation-driven transaction-manager="transactionManager"/>
-->
<!-- 定义事务通知 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<!-- 定义方法的过滤规则 -->
<tx:attributes>
<!-- 所有方法都使用事务 -->
<tx:method name="*" propagation="REQUIRED"/>
<!-- 定义所有get开头的方法都是只读的 -->
<tx:method name="get*" read-only="true"/>
</tx:attributes>
</tx:advice>
<!-- 定义AOP配置 -->
<aop:config>
<!-- 定义一个切入点
任意公共方法的执行:
execution(public * *(..))
任何一个以“set”开始的方法的执行:
execution(* set*(..))
AccountService 接口的任意方法的执行:
execution(* com.xyz.service.AccountService.*(..))
定义在service包里的任意方法的执行:
execution(* com.xyz.service.*.*(..))
定义在service包和所有子包里的任意类的任意方法的执行:
execution(* com.xyz.service..*.*(..))
定义在pointcutexp包和所有子包里的JoinPointObjP2类的任意方法的执行:
execution(* com.test.spring.aop.pointcutexp..JoinPointObjP2.*(..))")
-->
<aop:pointcut expression="execution (* com.service.*.*(..))" id="services"/>
<!-- 对切入点和事务的通知,进行适配 -->
<aop:advisor advice-ref="txAdvice" pointcut-ref="services"/>
</aop:config>
<bean name="allDao" class="com.dao.AlloyspecDao" >
<property name="sessionFactory" ref="sessionFactory1"/>
</bean>
<bean name="bomDao" class="com.dao.BomproductDao" >
<property name="sessionFactory" ref="sessionFactory1"/>
</bean>
<bean id="tservice" class="com.service.Tservice" >
<property name="allDao" ref="allDao"/>
<property name="bomDao" ref="bomDao"/>
</bean>
<bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping">
<property name="caseSensitive" value="false" />
</bean>
<!-- <a href="newsimpleform/index.do?action=update">sdfdsf</a>-->
<bean id="newsfct" class="comController.NewSimpleFormController" >
<property name="methodNameResolver">
<ref bean="paramMethodResolver"/>
</property>
<property name="tserice" ref="tservice"/>
</bean>
<bean class="comController.LoginController" />
</beans>
- Spring Action TransactionManager
- MyBatis-Spring-TransactionManager
- MyBatis-Spring-TransactionManager
- MyBatis-Spring-TransactionManager
- MyBatis-Spring-TransactionManager
- Spring事务管理TransactionManager
- MyBatis-Spring-TransactionManager
- Spring事物管理器TransactionManager解析
- TransactionManager
- spring配置SessionFactory ,transactionManager以及其他特性
- spring配置SessionFactory ,transactionManager以及其他特性
- spring配置SessionFactory ,transactionManager以及其他特性
- spring中使用JOTM作为数据源及TransactionManager
- Spring和hibernate集成之sessionFactory和transactionManager
- TransactionManager (Lab)
- spring 在WebSphere Application Server V6.0.2.19 及以后版本中JTA transactionManager配置
- Spring in action 读书笔记
- Spring in action
- php curl用法
- Linux内存映射(mmap)
- Android View绘制流程(看过最详细的一篇)
- 传统产业如何在互联网时代创新与转型
- 利用OpenVSwitch构建多主机Docker网络
- Spring Action TransactionManager
- 解决文件名太长或文件夹路径太深无法删除
- Sql Server参数化查询之where in和like实现之xml和DataTable传参
- pat_1012
- JAVA-手写服务器
- qsort和sort函数用法区别
- javaee学习之路(二十三)JFreeChart
- 正确使用Java事件通知
- json与对象的相互转化