`

spring <aop:pointcut>标签 expression属性如何定义路径

 
阅读更多
http://zhidao.baidu.com/question/497318436.html

execution(* com.aptech.jb.epet.dao.hibimpl.*.*(..))
这样写应该就可以了
这是com.aptech.jb.epet.dao.hibimpl 包下所有的类的所有方法。。
第一个*代表所有的返回值类型
第二个*代表所有的类
第三个*代表类所有方法
最后一个..代表所有的参数。

任意公共方法的执行:
execution(public * *(..))
任何一个名字以“set”开始的方法的执行:
execution(* set*(..))
AccountService接口定义的任意方法的执行:
execution(* com.xyz.service.AccountService.*(..))
在service包中定义的任意方法的执行:
execution(* com.xyz.service.*.*(..))
在service包或其子包中定义的任意方法的执行:
execution(* com.xyz.service..*.*(..))
在service包中的任意连接点(在Spring AOP中只是方法执行):
within(com.xyz.service.*)
在service包或其子包中的任意连接点(在Spring AOP中只是方法执行):
within(com.xyz.service..*)
在service包或其子包中的任意连接点(在Spring AOP中只是方法执行):within(com.xyz.service..*)
实现了AccountService接口的代理对象的任意连接点 (在Spring AOP中只是方法执行):
this(com.xyz.service.AccountService)
'this'在绑定表单中更加常用:- 请参见后面的通知一节中了解如何使得代理对象在通知体内可用。实现AccountService接口的目标对象的任意连接点 (在Spring AOP中只是方法执行):
target(com.xyz.service.AccountService)
'target'在绑定表单中更加常用:- 请参见后面的通知一节中了解如何使得目标对象在通知体内可用。任何一个只接受一个参数,并且运行时所传入的参数是Serializable 接口的连接点(在Spring AOP中只是方法执行)
args(java.io.Serializable)
'args'在绑定表单中更加常用:- 请参见后面的通知一节中了解如何使得方法参数在通知体内可用。请注意在例子中给出的切入点不同于
execution(* *(java.io.Serializable)):
args版本只有在动态运行时候传入参数是Serializable时才匹配,而execution版本在方法签名中声明只有一个 Serializable类型的参数时候匹配。目标对象中有一个 @Transactional 注解的任意连接点 (在Spring AOP中只是方法执行)
@target(org.springframework.transaction.annotation.Transactional)
'@target'在绑定表单中更加常用:- 请参见后面的通知一节中了解如何使得注解对象在通知体内可用。任何一个目标对象声明的类型有一个 @Transactional 注解的连接点 (在Spring AOP中只是方法执行):
@within(org.springframework.transaction.annotation.Transactional)
'@within'在绑定表单中更加常用:- 请参见后面的通知一节中了解如何使得注解对象在通知体内可用。任何一个执行的方法有一个 @Transactional 注解的连接点 (在Spring AOP中只是方法执行)
@annotation(org.springframework.transaction.annotation.Transactional)
'@annotation'在绑定表单中更加常用:- 请参见后面的通知一节中了解如何使得注解对象在通知体内可用。任何一个只接受一个参数,并且运行时所传入的参数类型具有@Classified 注解的连接点(在Spring AOP中只是方法执行)
@args(com.xyz.security.Classified)
'@args'在绑定表单中更加常用:- 请参见后面的通知一节中了解如何使得注解对象在通知体内可用。任何一个在名为'tradeService'的Spring bean之上的连接点 (在Spring AOP中只是方法执行):
bean(tradeService)
任何一个在名字匹配通配符表达式'*Service'的Spring bean之上的连接点 (在Spring AOP中只是方法执行):
bean(*Service)
分享到:
评论

相关推荐

    Spring AOP demo

    &lt;aop:pointcut id="pointcut2" expression="execution(public void com.jas.aop.bean.PersonImpl.sayBye(String))"/&gt; &lt;!-- 配置切面 --&gt; &lt;aop:aspect ref="loggingAspect"&gt; &lt;!-- 配置通知 --&gt; &lt;aop...

    struts2.3+hibernate3.6+spring3.1整合的纯xml配置的小项目

    expression="execution(* x.y.service.*Service.*(..))" /&gt; &lt;aop:pointcut id="noTxServiceOperation" expression="execution(* x.y.service.ddl.DefaultDdlManager.*(..))" /&gt; &lt;aop:advisor pointcut-ref=...

    Maven拆分代码.zip

    &lt;!--配置连接池--&gt; &lt;bean id="dataSource" class=... &lt;aop:pointcut id="pointcut" expression="execution(* com.itheima.service.impl.*.*(..))"/&gt; &lt;aop:advisor advice-ref="advice" pointcut-ref=

    Spring AOP配置源码

    &lt;aop:pointcut expression="execution(* com.spring.service..*(..))" id="pointCut"/&gt;声明一个切入点,注意execution表达式的写法 &lt;aop:before method="before" pointcut-ref="pointCut"/&gt; aop前置通知 &lt;aop:after ...

    三大框架下分页源代码

    &lt;aop:pointcut id="allServiceMethod" expression="execution(* com.cstp.service.*.*(..))"/&gt; &lt;aop:advisor pointcut-ref="allServiceMethod" advice-ref="txAdvice"/&gt; &lt;/aop:config&gt; &lt;!-- 新闻类型 --&gt; ...

    spring applicationContext 配置文件

    &lt;aop:pointcut id="allManagerMethodPdm" expression="execution(* com.ccc.pdm..*.*(..))"/&gt; &lt;aop:advisor pointcut-ref="allManagerMethodPdm" advice-ref="txAdvicePdm"/&gt; &lt;/aop:config&gt; &lt;!-- ibatis...

    JTA事务源码示例

    &lt;bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBean"/&gt; &lt;!-- JTA事务管理器 --&gt; &lt;bean id="myJtaManager" class="org.springframework.transaction.jta.JtaTransactionManager"&gt; ...

    SSH第7章上机.zip ACCP8.0

    &lt;aop:pointcut expression="execution(* com.direct.service.*.*(..))" id="transactionPointCut"/&gt; &lt;aop:advisor advice-ref="transactionAdvice" pointcut-ref="transactionPointCut"/&gt; &lt;/aop:config&gt; spring和...

    springmvc-ibatis

    &lt;aop:pointcut expression="execution(* com.org.service.*.*(..))" id="bussinessService" /&gt; &lt;aop:advisor advice-ref="txAdvice" pointcut-ref="bussinessService"/&gt; &lt;/aop:config&gt; &lt;!-- 配置那个类那个...

    SpringMVC+Hibernate全注解整合

    &lt;aop:advisor advice-ref="txAdvice" pointcut-ref="bussinessService" /&gt; &lt;/aop:config&gt; &lt;!-- 配置那个类那个方法用到事务处理 --&gt; &lt;tx:advice id="txAdvice" transaction-manager="transactionManager"&gt; ...

    springmvcmybatis

    -- 定义事务传播属性 --&gt; &lt;tx:attributes&gt; &lt;tx:method name="insert*" propagation="REQUIRED" /&gt; &lt;tx:method name="update*" propagation="REQUIRED" /&gt; &lt;tx:method name="edit*" propagation="REQUIRED" /...

    spring3.2+strut2+hibernate4

    -- &lt;aop:pointcut id="myPointcut" expression="execution(public * com.sbz.*.service.*.*(..))"/&gt;--&gt; &lt;!-- &lt;aop:advisor advice-ref="myAdvice" pointcut-ref="myPointcut"/&gt;--&gt; &lt;!-- &lt;/aop:config&gt;--&gt; &lt;!--AOP...

    SpringMVC-SSH全注解

    &lt;aop:advisor advice-ref="txAdvice" pointcut-ref="bussinessService" /&gt; &lt;/aop:config&gt; &lt;!-- 配置那个类那个方法用到事务处理 --&gt; &lt;tx:advice id="txAdvice" transaction-manager="transactionManager"&gt; ...

    spring security 参考手册中文版

    &lt;表达式处理器&gt;属性 297 41.1.21 &lt;form-login&gt; 297 &lt;form-login&gt;的父元素 298 &lt;form-login&gt;属性 298 41.1.22 &lt;http-basic&gt; 299 &lt;http-basic&gt;的父元素 300 &lt;http-basic&gt;属性 300 41.1.23 ...

    基于方法的切片缓存插件Aspect-Cache-Plug.zip

    &lt;/bean&gt;加入spring支持&lt;aop:config&gt;   &lt;aop:pointcut id="adviceAspectPoint" expression="execution(* com.sample..*.*(..)) and @annotation(Aspect)" /&gt;   &lt;aop:aspect ref="adviceAspect"&gt;   &lt;aop:...

    springboot学习思维笔记.xmind

    Spring-Expression AOP Spring-AOP Spring-Aspects Messaging Spring-Messaging WEB Spring-Web Spring-Webmvc Spring-WebSocket Spring-Webmvc-...

    aspectj-1.8.5.jar

    jdk1.7 spring aop报错 请下载aspectj-1.8.5.jar 更换低版本程序,再不行下载最新的aspectjweaver.jar

    spring-framework-reference-4.1.2

    3. New Features and Enhancements in Spring Framework 4.0 ............................................ 17 3.1. Improved Getting Started Experience .........................................................

    spring-framework-reference4.1.4

    3. New Features and Enhancements in Spring Framework 4.0 ............................................ 17 3.1. Improved Getting Started Experience .........................................................

Global site tag (gtag.js) - Google Analytics