Spring AOP 中 Pointcut的用法

2021-10-08 11:57:06 字數 1368 閱讀 8153

1.格式:

execution(modifiers-pattern? ret-type-pattern declaring-type-pattern? name-pattern(param-pattern)throws-pattern?)

括號中各個pattern分別表示:

修飾符匹配(modifier-pattern?)

返回值匹配(ret-type-pattern)可以為*表示任何返回值,全路徑的類名等

類路徑匹配(declaring-type-pattern?)

方法名匹配(name-pattern)可以指定方法名 或者*代表所有, set* 代表以set開頭的所有方法

引數匹配((param-pattern))可以指定具體的引數型別,多個引數間用「,」隔開,各個引數也可以用「」來表示匹配任意型別的引數,如(string)表示匹配乙個string引數的方法;(,string) 表示匹配有兩個引數的方法,第乙個引數可以是任意型別,而第二個引數是string型別;可以用(…)表示零個或多個任意引數

異常型別匹配(throws-pattern?)

其中後面跟著「?」的是可選項

2.也就是這樣表示:(看起來也好複雜)

execution([修飾符] (返回值) (類路徑) (方法名) ((引數匹配)) 異常型別 ? )

3.把它可選項去除就成如圖:()

具體詳解

@pointcut(

"execution(* com.fanlan.service.uesrserviceimpl.*(..))"

)

含義:表示在uesrserviceimpl類下的所有方法

execution(* *(

..))

含義:表示匹配所有方法

execution(public * com.fanlan.service.uesrserviceimpl.*(

..))

含義:表示匹配com.fanlan.service.uesrserviceimpl中所有的公有方法

execution(* com.fanlan.service..*.*(..))
含義:表示匹配com.fanlan.service包及其子包下的所有方法

execution(* com.fanlan.service.*.*(

..))

含義:在指定包下的所有方

point 出處不明

題目大意 給你n個點,m個操作,每個操作有兩個引數k,a把所有滿足y k x a 的點刪掉,當然每個點只能被刪一次,要求輸出每個點時被哪個操作刪的,如果最後仍沒被刪就 1 保證所有的數都是正數 x,y,k,a都是實數,不超過10 6 這題因為是y k x a 比較蛋疼,所以把其化成alnx lny ...

了解掌握spring aop 中

1.前置增強,業務層和aop攔截 如下 package com.mimoprint.schedule.service import lombok.extern.slf4j.slf4j import org.springframework.stereotype.service service slf4...

QwtPlotCurve 點(Point)滑鼠移動

因工作需要,要利用滑鼠移動曲線上的資料點,採用的控制項是qwt qwtplot的滑鼠移動操作有點麻煩,費了一下午時間才調通,參考了官方例程 itemeditor 主要的幾個函式是下面的 private bool pressed const qpoint bool moved const qpoint...