Spring(5) -(14) pointcut 語法
AOP的規範本應該由SUM公司提出,但是被AOP聯盟捷足先登.AOP聯盟指定AOP規範,首先就要解決一個問題,怎麼表示切入點,也就是在哪些方法上增強(where)
AspectJ 是一個面向切面的框架:
AspectJ切入點語法如下:(表示在哪些包下的哪些類的哪些方法做切入增強)
execution(modifiners-pattern?ret-type-pattern declaring-type-pattern? name-param(param-patterm)throws-pattern?)
?表示:該引數可以出現一次或零次
翻譯成中文:
execution(<修飾符>?<返回型別> <宣告型別>?<方法名>(<引數>)<異常>?)
舉例:public static Class java.lang.Class.forName(String className) throws ClassNotFoundException
萬用字元
*
匹配任何部分,只能表示一個單詞
..
可用於全限定名中和方法引數中,分別表示子包和0到N個引數
spring-core 文件中的例子
Some examples of common pointcut expressions are given below.
the execution of any public method:
execution(public * *(..))
the execution of any method with a name beginning with "set":
execution(* set*(..))
the execution of any method defined by the AccountService interface:
execution(* com.xyz.service.AccountService.*(..))//常用
the execution of any method defined in the service package:
execution(* com.xyz.service.*.*(..))//常用
the execution of any method defined in the service package or a sub-package:
execution(* com.xyz.service..*.*(..))//常用
相關文章
- Spring事務管理—aop:pointcut expression解析SpringExpress
- 解決報錯error the @annotation pointcut expression is only supported at Java 5ErrorExpressJava
- spring語法結構Spring
- html5語法HTML
- 錯誤pointcut is null in InterceptorsChainNullAI
- Spring 原始碼(14)Spring Bean 的建立過程(5)Spring原始碼Bean
- HTML5語法總結HTML
- 英語語法(5) 形容詞和副詞之二
- HTML5的語法的改變HTML
- 標日初級(上)——第14課(語法2)
- Hive基礎語法5分鐘速覽Hive
- Python 中 PyQt5 庫語法(一)PythonQT
- oracle10g_rman_語法測試_5Oracle
- 帶你瞭解Typescript的14個基礎語法TypeScript
- aspectJ中怎樣獲得呼叫 pointcut 的物件物件
- Linux-Shell語法(5)-常用命令Linux
- Go編譯原理系列5(抽象語法樹構建)Go編譯原理抽象語法樹
- SAP UI5 的資料繫結語法概述UI
- JavaScript 新語法 「雙問號語法」與「可選鏈語法」JavaScript
- 全棧 - 14 ggplot2 基本語法和基礎圖形全棧
- C++ error C2143: 語法錯誤: 缺少“;”(在“*”的前面)C++Error
- sql case語法和plsql case語法!SQL
- 語法與語義
- 使用Python語言編寫簡單的HTML5語法解析器PythonHTML
- protobuf 語法,proto3 語法參考
- Dart語法篇之基礎語法(一)Dart
- JAVA語法糖和語法糖編譯Java編譯
- dockerfile 語法Docker
- markdown 語法
- 模板語法
- SQL語法SQL
- 語法糖
- Makedown語法
- JavaScript語法JavaScript
- Emmet語法
- jQuery 語法jQuery
- jQuery語法jQuery
- JS語法JS