---
title: "Spring 2.x AOP 配置方式整理"
author: "kidfang"
date: "2009-06-01T15:58:05Z"
tags: []
slug: "spring-2-x-aop"
draft: false
lastmod: "2009-06-01T15:59:22Z"
id: 399663
url: "https://kidfang.iteye.com/blog/399663"
---

常见的情况：  
x.y.service..\*Service.\*(..)  
x.y.service —— 包“x.y.service”  
x.y.service.. —— 包“x.y.service”及其子包例如：“x.y.service.abc”，“x.y.service.def”，“x.y.service.ghi”，“x.y.service.jkl”。。。  
\*Service —— 定义接口（或没有实现接口的类，需要使用cglib代理）表达式；所有以Service结尾的类或接口，注意不是所有以Service结尾的包名。  
\*(..) —— 定义方法名，方法参数表达式；任意方法的名称，任意方法参数。

com.xyz.service.\*.\*（..）  
com.xyz.service —— 包“com.xyz.service”  
\*.\*（..） —— 任意接口（或没有实现接口的类，需要使用cglib代理），任意方法，任意参数  
在service包下定义的任意方法的执行。

com.xyz.service..\*.\*（..）  
com.xyz.service —— 包“com.xyz.service”  
com.xyz.service.. ——包“com.xyz.service”及其子包  
\*.\*（..） —— 任意接口（或没有实现接口的类，需要使用cglib代理），任意方法，任意参数