小伙伴们,我开了一家海淘护肤品淘宝店,搜索店铺“禾子蝶的海淘铺”,正品保证,欢迎进店选购哦。谢谢!
applicationContext.xml 文件配置,可以查看事物这块
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-4.0.xsd"
default-lazy-init="false">
<description>Spring公共配置 </description>
<context:component-scan base-package="com.cmcc.service,com.cmcc.dao,com.cmcc.exception" />
<util:properties id="dataSourceProps" location="classpath:system.properties"/>
<!--启用aop代理 -->
<aop:aspectj-autoproxy/>
<!-- 数据源配置,使用应用内的DBCP数据库连接池 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<!-- Connection Info -->
<property name="driverClassName" value="#{dataSourceProps['jdbc.driver']}" />
<property name="url" value="#{dataSourceProps['jdbc.url']}" />
<property name="username" value="#{dataSourceProps['jdbc.username']}" />
<property name="password" value="#{dataSourceProps['jdbc.password']}" />
<property name="defaultAutoCommit" value="false" />
<!-- Connection Pooling Info -->
<property name="maxActive" value="#{dataSourceProps['dbcp.maxActive']}" />
<property name="maxIdle" value="#{dataSourceProps['dbcp.maxIdle']}" />
</bean>
<!--事务管理开始 -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
<aop:config>
<aop:pointcut expression="execution(public * com.cmcc.service..*.*(..))" id="businessService" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="businessService" order="2"/>
</aop:config>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED"/>
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="del*" propagation="REQUIRED"/>
<tx:method name="put*" propagation="REQUIRED"/>
<tx:method name="edit*" propagation="REQUIRED"/>
<tx:method name="sort*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<!-- 事务管理结束 -->
<!-- Spring iBatis SqlMapClient -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mapperLocations" value="classpath*:com/cmcc/dao/mapper/**/*.xml"/>
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.cmcc.dao"/>
<property name="sqlSessionFactory" ref="sqlSessionFactory"></property>
</bean>
<bean id="springContextHolder" class="com.cmcc.util.SpringContextHolder" lazy-init="false" />
<task:annotation-driven executor="myExecutor" scheduler="myScheduler"/>
<task:executor id="myExecutor" pool-size="5"/>
<task:scheduler id="myScheduler" pool-size="10"/>
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- <property name="maxUploadSize" value="10485760" /> -->
</bean>
</beans>
小伙伴们,我开了一家海淘护肤品淘宝店,搜索店铺“禾子蝶的海淘铺”,正品保证,欢迎进店选购哦。谢谢!
相关推荐
Spring中的@Transactional事物回滚实例源码
自己做的一个简单的spring运用实例,主要是关于事务回滚的一个小例子,希望对还在纠结事务回滚的童靴有点帮助。。。
1. 基于Aspectj实现动态数据源...6. 实现事务内切换数据源(支持原生Spring声明式事务哟,仅此一家),并支持多数据源事务回滚(有了它除了跨服务的事务你需要考虑分布式事务,其他都不需要,极大的减少了系统的复杂程度)
NULL 博文链接:https://sunfish.iteye.com/blog/1534890
Spring事务管理A方法内部调用B方法的回滚问题测试代码
事物回滚
花了一晚上时间终于搞出来了Spring整合Mybatis事务回滚(Mysql数据库),控制Service层中的多次插入操作,多次操作整体是一个事务。 里面有缘嘛和jar包,资源为war包,导入即可。运行Test类中的测试代码即可。 建表...
Spring中的JdbcTemplate,Spring中的的事务.。。。。。。。
Spring/SpringMVC/MyBatis整合,可事务回滚
ADO实现数据回滚事物+DBGrid选中多行处理,不解释,懂Delphi的人都懂的
spring boot 纯注解方法事务控制回滚,注解+简单配置文件使用多线程demo
Spring的事务管理默认只对出现运行期异常(java.lang.RuntimeException及其子类)进行回滚,需要了解更多Spring事务方面的知识,可详看本
oracle回滚段使用率过高之解决方法 推荐针对不同的情况有多种解决.
事物例子(构件,开始,提交,回滚) ()
Spring中@Transactional事务回滚(含实例详细讲解,附源码)Java开发Java经验技巧共8页.pdf.zip
oracle 回滚段管理
主要给大家介绍了关于mongoDB 4.0事务回滚的相关资料,文中通过示例代码介绍的非常详细,对大家学习或者使用MongoDB具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
使用MySQL时,如果发现事务无法回滚,但Hibernate、Spring、JDBC等配置又没有明显问题,到底是什么原因,下面与大家分享下
SQL 事务回滚解决回滚无效的情况 BEGIN TRY END TRY CAHTH