AOP切入点的配置
[public] String Com.liubo.userDao.save(User)
1.2.2.2 execution(* ) 固定表达式,表示配置切点
1.2.2.3 * 替代包,类,方法 com.bjsxt.service.impl.TestServiceImpl.*()匹配TestServiceImpl中的所有无参方法
com.bjsxt.service.impl.TestServiceImpl.b(string,int)
1.2.2.4 .. 任意参数 com.bjsxt.service.impl.TestServiceImpl.*(..)匹配TestServiceImpl中的所有方法
com.bjsxt.service.impl.*.*(..)匹配包中任意类的任意方法
*:还可以替代包,类,方法
..:替代的是方法的参数,代表的是任意参数类型。或者是没有
<aop:pointcut expression="execution(* spring4_aop.ProductDaoImpl.add())" id="mypoint" />规则:[访问修饰符] 方法返回值 包名.类名.方法名(方法参数)[public] String Com.liubo.userDao.save(User)
1.2.2.2 execution(* ) 固定表达式,表示配置切点
1.2.2.3 * 替代包,类,方法 com.bjsxt.service.impl.TestServiceImpl.*()匹配TestServiceImpl中的所有无参方法
com.bjsxt.service.impl.TestServiceImpl.b(string,int)
1.2.2.4 .. 任意参数 com.bjsxt.service.impl.TestServiceImpl.*(..)匹配TestServiceImpl中的所有方法
com.bjsxt.service.impl.*.*(..)匹配包中任意类的任意方法
<aop:pointcut expression="execute(* 切方法的权限定路径.方法名())" id="popint" /> *:第一个 * ,代表方法的返回值的类型是 任意类型*:还可以替代包,类,方法
..:替代的是方法的参数,代表的是任意参数类型。或者是没有
本文详细介绍了AOP(面向切面编程)中的切入点配置方法,包括如何使用表达式指定目标方法,例如通过通配符匹配不同层级的方法签名,以及如何定义任意类型的返回值和参数。
1390

被折叠的 条评论
为什么被折叠?



