Various pointcut expressions in Spring AOP
Below is the list of various pointcut expressions that can be used in AOP
1 – Any Method in a Specific Class:
execution(* com.sks.Employee.*(..))
2 – Any Method with a Specific Return Type:
execution(String com.sks.Employee.getName())
3 – Any Method with a Specific Parameter Type:
execution(* com.sks.Employee.setIncome(float))
4 – Any Method with No Parameters:
execution(* com.sks.Employee.*())
5 – Any Public Method in a Package:
execution(public * com.sks..*.*(..))
6 – Any Method with a Specific Annotations:
execution(* *(..)) && @annotation(com.sks.annotations.Loggable)
7 – All Methods Starting with a Specific Prefix such as get in this case:
execution(* com.sks.Employee.get*())
8 – Any Method from Any Class in a Specific Subpackage:
execution(* com.sks.subpackage..*.*(..))
9 – Any Method in All Classes:
execution(* *(..))
10 – Private Methods in a Specific Class:
execution(private * com.sks.Employee.*(..))