<!-- 配置那些類的方法進行事務管理 --> <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 寫!,國內一般用|| && !。