spring aop 切點聲明

多條件   ||  java


 

任意公共方法的執行:
execution(public * *(..))spring


任何一個以「set」開始的方法的執行:
execution(* set*(..))this


AccountService 接口的任意方法的執行:
execution(* com.xyz.service.AccountService.*(..)).net


定義在service包裏的任意方法的執行:
execution(* com.xyz.service.*.*(..))代理


定義在service包或者子包裏的任意方法的執行:
execution(* com.xyz.service..*.*(..))orm


在service包裏的任意鏈接點(在Spring AOP中只是方法執行) :
within(com.xyz.service.*)對象


在service包或者子包裏的任意鏈接點(在Spring AOP中只是方法執行) :
within(com.xyz.service..*)接口


實現了 AccountService 接口的代理對象的任意鏈接點(在Spring AOP中只是方法執行) :
this(com.xyz.service.AccountService)get


'this'在binding form中f用的更多:- 請常見如下討論通知的章節中關於如何使得代理對象能夠在通知體內訪問到的部分。
實現了 AccountService 接口的目標對象的任意鏈接點(在Spring AOP中只是方法執行) :
target(com.xyz.service.AccountService)it


'target'在binding form中用的更多:- 請常見如下討論通知的章節中關於如何使得目標對象能夠在通知體內訪問到的部分。
任何一個只接受一個參數,且在運行時傳入的參數實現了 Serializable 接口的鏈接點 (在Spring AOP中只是方法執行)
args(java.io.Serializable)


'args'在binding form中用的更多:- 請常見如下討論通知的章節中關於如何使得方法參數能夠在通知體內訪問到的部分。 請注意在例子中給出的切入點不一樣於 execution(* *(java.io.Serializable)): args只有在動態運行時候傳入參數是可序列化的(Serializable)才匹配,而execution 在傳入參數的簽名聲明的類型實現了 Serializable 接口時候匹配。


有一個 @Transactional 註解的目標對象中的任意鏈接點(在Spring AOP中只是方法執行)
@target(org.springframework.transaction.annotation.Transactional)


'@target' 也能夠在binding form中使用:請常見如下討論通知的章節中關於如何使得annotation對象能夠在通知體內訪問到的部分。
任何一個目標對象聲明的類型有一個 @Transactional 註解的鏈接點(在Spring AOP中只是方法執行)
@within(org.springframework.transaction.annotation.Transactional)


'@within'也能夠在binding form中使用:- 請常見如下討論通知的章節中關於如何使得annotation對象能夠在通知體內訪問到的部分。
任何一個執行的方法有一個 @Transactional annotation的鏈接點(在Spring AOP中只是方法執行)
@annotation(org.springframework.transaction.annotation.Transactional)

'@annotation' 也能夠在binding form中使用:- 請常見如下討論通知的章節中關於如何使得annotation對象能夠在通知體內訪問到的部分。 任何一個接受一個參數,而且傳入的參數在運行時的類型實現了 @Classified annotation的鏈接點(在Spring AOP中只是方法執行) @args(com.xyz.security.Classified) 

相關文章
相關標籤/搜索