在面向切面编程中(AOP),往往最先要做的事是配置切入点,官方文档中的切入点表达式如下所示:
语法:指示符(访问修饰符(可选) 返回值类型(必须) 包名类名(可选) 方法(必须) 参数)
execution(modifiers-pattern? ret-type-pattern declaring-type-pattern?name-pattern(param-pattern) throws-pattern?)
execution(public * com.ljb.service.impl.BookServiceImpl.select())
execution(* com.ljb.service.impl.BookServiceImpl.select ())
execution(* *.*.*.*.*.select())
execution(* com..BookServiceImpl.select())
execution(* com..*BookServiceImpl.*())
execution(* com..*BookServiceImpl.*(..)) 参数任意,可有可无
execution(* com..*BookServiceImpl.*(*)) 参数个数任意,必须有
execution(* select*(..))
expression="execution(* select*(..)) || execution(* add*(..))
expression="execution(* select*(..)) or execution(* add*(..))
拦截容器中BookService类中的所有方法
expression="bean(BookService)"
拦截容器中Service结尾的类中的所有方法
expression="bean(*Service)"
expression="!execution(* select*(..))"
expression=" not execution(* select*(..))
