- 浏览: 1106253 次
- 性别:
- 来自: 成都
-
文章分类
最新评论
-
skyesx:
这是2PC实现,更常用的是一个柔性事务的实现,可以参考http ...
Spring分布式事务实现 -
ddbird:
这第一句就不严谨“分布式事务是指操作多个数据库之间的事务”,显 ...
Spring分布式事务实现 -
呵呵6666:
基于互联网支付系统的微服务架构分布式事务解决方案http:// ...
Spring分布式事务实现 -
小黄牛:
写得不错,交流群:472213887
Spring分布式事务实现 -
jiaoqf321456:
这明明是用的apache的压缩,给ant.jar有半毛钱关系吗 ...
使用ant.jar进行文件zip压缩
(1)配置:
Spring的事务管理是通过AOP代理实现的,其中的事务通知由元数据驱动。代理对象与事务元数据结合产生一个AOP代理,它使用一个PlatformTransactionManager实现,配合TransactionInterceptor,在方法调用前后实施事务。
(2)测试
附:pointcut里的语法
execution(modifiers-pattern? ret-type-pattern declaring-type-pattern? name-pattern(param-pattern) throws-pattern?)其中带问号的modifiers-pattern?(public/protected) 和 declaring-type-pattern? throws-pattern? 可以不填
如execution(* *..BookManager.save(..))
第一颗* 代表ret-type-pattern 返回值可任意,
*..BookManager 代表任意Pacakge里的BookManager类。
如果写成com.xyz.service.* 则代表com.xyz.service下的任意类
com.xyz.service..* com.xyz.service则代表com.xyz.service及其子package下的任意类
save代表save方法,也可以写save* 代表saveBook()等方法
(..) 匹配0个参数或者多个参数的,任意类型
(x,..) 第一个参数的类型必须是X
(x,,,s,..) 匹配至少4个参数,第一个参数必须是x类型,第二个和第三个参数可以任意,第四个必须是s类型。
Spring的事务管理是通过AOP代理实现的,其中的事务通知由元数据驱动。代理对象与事务元数据结合产生一个AOP代理,它使用一个PlatformTransactionManager实现,配合TransactionInterceptor,在方法调用前后实施事务。
<?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:context="http://www.springframework.org/schema/context" 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.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"> <description>springApp</description> <!-- dataSource for MySQL --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://localhost:3306/springapp" /> <property name="username" value="root" /> <property name="password" value="****" /> </bean> <!-- Hibernate SessionFactory for MySQL --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="mappingDirectoryLocations"> <list> <value>classpath:/</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.MySQLDialect </prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.jdbc.fetch_size">50</prop> <prop key="hibernate.jdbc.batch_size">100</prop> </props> </property> </bean> <!--Transaction --> <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <aop:config> <!--use CGLIB:proxy-target-class="true--> <aop:pointcut id="serviceOperator" expression="execution(* com.logcd.business.service.*.*(..))"/> <aop:advisor advice-ref="txAdvice" pointcut-ref="serviceOperator"/> <!-- <aop:advisor pointcut="execution(* com.logcd.business.service..*Service.*(..))" advice-ref="txAdvice"/> --> </aop:config> <tx:advice id="txAdvice" transaction-manager="txManager"> <tx:attributes> <tx:method name="find*" read-only="true" /> <tx:method name="load*" read-only="true" /> <tx:method name="is*" read-only="true"/> <tx:method name="save*" rollback-for="Exception"/> <tx:method name="insert*" rollback-for="Exception" /> <tx:method name="remove*" rollback-for="Exception"/> <tx:method name="add*" no-rollback-for="Exception" /> </tx:attributes> </tx:advice> <!--Transaction --> <!-- DAO --> <bean id="genericDao" lazy-init="true" abstract="true" class="com.logcd.bo.dao.impl.GenericDaoImpl"> <property name="sessionFactory"> <ref local="sessionFactory" /> </property> </bean> <bean id="customersDao" parent="genericDao" class="com.logcd.bo.dao.impl.CustomersDaoImpl" /> <bean id="customerDao" parent="genericDao" class="com.logcd.bo.dao.impl.CustomerDaoImpl" /> <bean id="addressDao" parent="genericDao" class="com.logcd.bo.dao.impl.AddressDaoImpl" /> <bean id="customerManageService" class="com.logcd.business.service.impl.CustomerManageServiceImpl" autowire="byName"/> </beans>
(2)测试
package com.logcd.test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.logcd.bo.Customers; import com.logcd.business.service.CustomerManageService; import junit.framework.TestCase; public class SpringServiceTest extends TestCase { private CustomerManageService customerManageService; protected void setUp() throws Exception { super.setUp(); ApplicationContext app = new ClassPathXmlApplicationContext("appContext.xml"); customerManageService = (CustomerManageService) app.getBean("customerManageService"); } protected void tearDown() throws Exception { super.tearDown(); } public void testService() throws Exception{ Customers cus = new Customers(); cus.setName("testService"); cus.setAge(29); customerManageService.saveCustomers(cus); } }
附:pointcut里的语法
execution(modifiers-pattern? ret-type-pattern declaring-type-pattern? name-pattern(param-pattern) throws-pattern?)其中带问号的modifiers-pattern?(public/protected) 和 declaring-type-pattern? throws-pattern? 可以不填
如execution(* *..BookManager.save(..))
第一颗* 代表ret-type-pattern 返回值可任意,
*..BookManager 代表任意Pacakge里的BookManager类。
如果写成com.xyz.service.* 则代表com.xyz.service下的任意类
com.xyz.service..* com.xyz.service则代表com.xyz.service及其子package下的任意类
save代表save方法,也可以写save* 代表saveBook()等方法
(..) 匹配0个参数或者多个参数的,任意类型
(x,..) 第一个参数的类型必须是X
(x,,,s,..) 匹配至少4个参数,第一个参数必须是x类型,第二个和第三个参数可以任意,第四个必须是s类型。
- aspectjweaver.jar (1.8 MB)
- 下载次数: 40
发表评论
-
SpringBoot开发WebService之Axis
2019-07-14 23:56 5062一、服务器端发布WebService服务 1、POM.xml文 ... -
SpringBoot开发WebService之CXF
2019-07-14 23:56 1481一、在服务器端的WebSerivce服务发布 1、POM.xm ... -
SpringBoot项目非web方式启动
2019-07-03 17:02 48641、springboot 1.x中以非web方式启动 @S ... -
SpringBoot使用Druid数据库密码加密
2019-03-06 23:28 16031、生成公钥、私钥和密码加密串 java -cp drui ... -
Spring Annotation
2010-12-02 17:14 0Spring2.x引入了组件自动扫描机制,可以在类路径底 ... -
Spring分布式事务实现
2010-11-10 14:28 83283分布式事务是指操作多个数据库之间的事务,spring的 ... -
Spring3 Annotation + Hibernate3-jpa2.0 + CGLIB + 多数据源
2010-08-19 09:30 10555一、定义一个测试用Entity。 @Entity pub ... -
使用iBatis2.0
2010-05-26 10:20 0一、NULL问题 ibatis操作oracle数据库时, ... -
使用AspectJ LTW(Load Time Weaving)
2010-01-04 14:25 10863在Java 语言中,从 ... -
Spring2.0 AOP AspectJ 注释实现
2010-01-04 14:24 5651一、AOP基本概念 切面(Aspect): 一个关注点的模块 ... -
Spring + JPA + Hibernate配置
2010-01-04 14:24 34809<1>persistence.xml放到类路径下的 ... -
配置spring数据源
2009-11-06 16:47 1292配置一个数据源 Spring在第三方依赖包中包含了两 ... -
hibernate的dialect
2009-07-23 10:04 5509一、hibernate的dialect RDBM ... -
spring ibatis入门
2009-04-20 14:16 3945一、applicationContext.xml <?x ... -
Hibernate缓存配置/批量处理
2009-03-25 21:50 11039Hibernate除了自动对Se ... -
Hibernate的一级与二级缓存
2009-03-25 21:24 1739缓存是介于应用程序和物理数据源之间,其作用是为了降低应用 ... -
spring jdbcTemplate使用
2008-07-15 17:17 78315一、使用示例 (1)springJdbcContext.xml ... -
spring 事务管理
2008-07-08 16:35 12074声明式的事务管理(Declarative transactio ... -
Hibernate中one-to-many/many-to-one和many-to-many
2008-06-28 17:03 4008<1>one-to-many/many-to-on ... -
Hibernate中的对象one-to-one关系
2008-06-26 22:55 2521(1) 通过主健参考,限制2个数据表中的主健使用相同的值 c ...
相关推荐
Kotti 是一个基于 Pyramid 框架的 Python 内容管理系统(CMS),适合用来搭建中小型网站、文档库、企业展示平台、知识库等需要灵活内容结构和权限模型的项目。它本身更像一个可以二次开发的 CMS 框架,比 WordPress、Drupal 这类“一装就用”的系统更倾向于开发者定制和扩展。 这是支持pyramid2.x版本的kotti! tar -xzvf kotti1.0.tar.gz 解压缩 进入目录执行 pip install -e . 来安装, 然后执行pserve app.ini 启动。 用浏览器浏览127.0.0.1:5000 即可浏览。 用户名admin ,口令qwerty
cmd-bat-批处理-脚本-hello world.zip
知识付费系统自动采集V3.0 跳转不卡顿+搭建教程,不和外面的一样跳转卡顿,这个跳转不卡顿,支持三级分销。
在Matlab环境下,对图像进行特征提取时,主要涵盖形状、纹理以及颜色这三大关键特征。其中,对于纹理特征的提取,采用灰度梯度共生矩阵这一方法来实现。通过灰度梯度共生矩阵,可以有效地捕捉图像中像素灰度值之间在不同方向和距离上的相互关系,进而量化地反映出图像的纹理特性,为后续的图像分析、分类等任务提供重要的纹理信息依据。
该数据集为2010-2023年中国A股上市公司管理层情感语调的年度面板数据,覆盖45,320条样本,数据源自年报及半年报的"管理层讨论与分析"部分。通过构建中文金融情感词典(融合《知网情感分析用词典》与L&M金融词汇表),采用文本分析方法计算情感语调指标,包括:正面/负面词汇数量、文本相似度、情感语调1((积极词-消极词)/总词数)和情感语调2((积极词-消极词)/(积极词+消极词))。同时包含盈利预测偏差、审计意见类型等衍生指标,可用于研究信息披露质量、市场反应及代理问题。该数据复刻了《管理世界》《财经研究》等期刊的变量构建方法,被应用于分析语调操纵对债券市场的影响,学术常用度与稀缺度较高。
cmd-bat-批处理-脚本-FTIME.zip
1747829038637.png
2025年自动化X光检查机项目大数据研究报告.docx
在计算机组成原理课程设计中,我全程跟随老师的指导,独立完成了以下两项任务:一是利用Logisim软件进行原码一位乘法器的仿真设计,通过逐步搭建电路、配置逻辑单元,实现了原码乘法运算的完整流程,深入理解了原码乘法的原理和实现机制;二是完成了补码一位乘法器的Logisim仿真,同样按照老师讲解的步骤,精心设计电路,确保补码乘法运算的正确性,进一步掌握了补码乘法的运算规则和电路实现方法。通过这两个项目,我不仅巩固了理论知识,还提升了动手实践能力和逻辑思维能力。
cmd-bat-批处理-脚本-msvc2017.zip
cmd-bat-批处理-脚本-virtualcam-install.zip
二十四节气之立秋介绍.pptx
cmd-bat-批处理-脚本-shift.zip
二十四节气之小雪介绍.pptx
java、SpringBoot面试专题,6页面试题
cmd-bat-批处理-脚本-GenerateUnionWinMD.zip
二十四节气之大暑节气.pptx
python实现五子棋游戏源码
cmd-bat-批处理-脚本-TransparentConsole.zip
cmd-bat-批处理-脚本-ppcp.zip