java - AspectJ Pointcut matching pattern -


i've written pointcut call around advice on execution of method.

however, i'd understand why final pattern used works, initial pattern didn't.

the initial pattern used (which didn't work) was:

pointcut timeit() : execution(* *.authfilter.filter(..)); 

the pattern works is:

 pointcut timeit() : execution(* *..*.authfilter.filter(..)); 

trying google difference between *. , *..*. has proved challenging. if provide either explanation or resource explains difference grateful.

it explained documentation:

aspectj type patterns

an embedded * in identifier matches sequence of characters, not match package (or inner-type) separator ".".

an embedded .. in identifier matches sequence of characters starts , ends package (or inner-type) separator ".".

basically, when used @ package level, .. means sub-packages.

your first expression matches if authfilter in second level, example, org.authfilter, not match org.security.authfilter, in case need *.*.authfilter.

your second expression matching authfilter wherever is. not matter package , sub package in.

@aspectj cheat sheet


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -