---
title: "(转)expression=\"execution(*service..*.*(..))\""
author: "I_conquer"
date: "2014-10-23T11:05:02Z"
tags: []
categories: ["开源软件"]
slug: "expression-execution-service"
draft: false
lastmod: "2014-10-23T11:05:02Z"
id: 2146991
url: "https://i-conquer.iteye.com/blog/2146991"
---

（* com.evan.crm.service.\*.\*（..））中几个通配符的含义： 

|第一个 * —— 通配 随便率性返回值类型|   
|第二个 * —— 通配包com.evan.crm.service下的随便率性class|   
|第三个 * —— 通配包com.evan.crm.service下的随便率性class的随便率性办法|   
|第四个 .. —— 通配 办法可以有0个或多个参数| 

 

&lt;!-- 配置那些类的方法进行事务管理 --&gt;   
&lt;aop:config&gt;   
&lt;aop:pointcut id="allServiceMethod" expression="execution (* com.cms.sys.service.\*.\*(..))" /&gt;  
&lt;aop:advisor advice-ref="txAdvice" pointcut-ref="allServiceMethod" /&gt;   
&lt;/aop:config&gt; 

还有一个   
execution (* com.cms.art.service.\*.\*(..))" 

要怎么写？

 

 

可以这样写：将execution分开写。   
&lt;aop:config&gt;   
&lt;aop:pointcut id="allServiceMethod" expression="(execution (* com.cms.sys.service.\*.\*(..)))or (execution (* com.cms.art.service.\*.\*(..)))" /&gt;  
&lt;aop:advisor advice-ref="txAdvice" pointcut-ref="allServiceMethod" /&gt;   
&lt;/aop:config&gt; 

 

原文地址：[http://hi.baidu.com/suofang/item/1bea72b7315c3497194697ea](http://hi.baidu.com/suofang/item/1bea72b7315c3497194697ea)