<aop:config>
<aop:pointcut id="allServiceMethod" expression="execution (* com.cms.sys.service.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="allServiceMethod" />
</aop:config>
还有一个
execution (* com.cms.art.service.*.*(..))"
要怎么写?
可以这样写:将execution分开写。
<aop:config>
<aop:pointcut id="allServiceMethod" expression="(execution (* com.cms.sys.service.*.*(..))) or (execution (* com.cms.art.service.*.*(..)))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="allServiceMethod" />
</aop:config>
老外喜欢吧逻辑运算符用or,and !写,国内一般用|| && !。
参考E文详细的资料:
[url=http://www.jboss.org/file-access/default/members/jbossaop/freezone/docs/2.0.0.GA/docs/aspect-framework/reference/en/html/annotated.html
]http://www.jboss.org/file-access/default/members/jbossaop/freezone/docs/2.0.0.GA/docs/aspect-framework/reference/en/html/annotated.html[/url]http://www.jboss.org/file-access/default/members/jbossaop/freezone/docs/2.0.0.GA/docs/aspect-framework/reference/en/html/pointcuts.html
本文介绍如何在Spring中配置事务管理,通过AOP实现对指定包下所有服务类的方法进行事务控制。具体包括定义切入点和通知,并使用逻辑运算符组合多个切入点表达式。
2524





