Spring事务管理—aop:pointcut expression解析
来源:互联网 发布:有tm商标能上淘宝吗 编辑:程序博客网 时间:2024/05/16 07:13
先来看看这个spring的配置文件的配置:
<!-- 事务管理器 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- 配置事务的传播特性 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="get*" propagation="REQUIRED" read-only="true" />
<tx:method name="del*" propagation="REQUIRED" />
<tx:method name="save*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
<!-- 配置事务拦截器拦截哪些类的哪些方法,一般设置成拦截Service -->
<aop:config>
<aop:pointcut expression="execution(* com.xy.service.*.*(..))"
id="allDaoMethod" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="allDaoMethod" />
</aop:config>
表示com.xy.service包下的所有方法为为事务管理。
execution(* com.aptech.jb.epet.dao.hibimpl.*.*(..))
这样写应该就可以了 这是com.aptech.jb.epet.dao.hibimpl 包下所有的类的所有方法。。
第一个*代表所有的返回值类型
第二个*代表所有的类
第三个*代表类所有方法 最后一个..代表所有的参数。
下面给出一些常见切入点表达式的例子:
任意公共方法的执行:
execution(public * *(..))
任何一个以“set”开始的方法的执行:
execution(* set*(..))
AccountService
接口的任意方法的执行:execution(* com.xyz.service.AccountService.*(..))
定义在service包里的任意方法的执行:
execution(* com.xyz.service.*.*(..))
定义在service包或者子包里的任意类的任意方法的执行:
execution(* com.xyz.service..*.*(..))
- Spring事务管理—aop:pointcut expression解析
- Spring事务管理—aop:pointcut expression解析
- Spring事务管理—aop:pointcut expression解析
- Spring事务管理—aop:pointcut expression解析
- Spring事务管理—aop:pointcut expression解析
- Spring事务管理—aop:pointcut expression解析
- Spring事务管理—aop:pointcut expression解析
- Spring事务管理—aop:pointcut expression解析
- Spring事务管理—aop:pointcut expression解析
- Spring事务管理—aop:pointcut expression解析
- Spring事务管理—aop:pointcut expression解析
- Spring事务管理—aop:pointcut expression解析
- Spring事务管理—aop:pointcut expression解析
- Spring事务管理—aop:pointcut expression解析
- Spring事务管理—aop:pointcut expression解析(转)
- 最全面的 Spring事务管理和AOP切面日志的注入 —aop:pointcut expression解析
- Spring事务管理—aop:pointcut 属性expression格式说明
- Spring AOP中pointcut expression表达式解析
- JQuery find 获取 带命名空间 匹配元素值
- Android SharedPreferences 使用
- LeetCode的medium题集合(C++实现)十
- 所有节点对最短路径 超时 优先队列 + dijkstra + 遍历前驱子图
- JAXBContext解析XML集合对象
- Spring事务管理—aop:pointcut expression解析
- 非常炫酷的刷新效果赏析
- 三招应对这些最难面试问题
- apache的安装和配置
- 蓝桥杯准备中---------------UART串行通信----------------人机交互系统(擅长)
- Oculus发布程序运行报错 以及 数据库读取不出来解决方案
- 一行代码保存fckeditor编辑器提交的内容到文件(接上一博)
- AndroidMainfest.xml文件中的android属性
- 分支限界(Branch and Bound )算法