当前位置: 代码迷 >> 综合 >> spring 注解aop切入点表达式怎么排除某些方法
  详细解决方案

spring 注解aop切入点表达式怎么排除某些方法

热度:89   发布时间:2023-09-20 02:47:24.0

@Pointcut("!execution(* aa.bb..*.set*(..)) and execution(* aa.bb..*.*(..)) ")

如果是这种形式的法执行了很多其他方法         比如init
@Pointcut("execution(* aa.bb..*.*(..)) and !execution(* aa.bb..*.set*(..)) ")
这种形式还是都执行了

可以 把   and  换成 &&  就可以解决了。将方法上抛出的exception去掉  登录状态用切面检查,排除login接口拦

@Pointcut("execution(* aa.bb..*.*(..))  && !execution(* aa.bb.cc.login(..)) ")

  相关解决方案