原创

aop排除package下部分的class

1、java学习-springaop AOP-execution格式说明

参考:java学习-springaop AOP-execution格式说明

2、aop排除的实现部分class的方式

2.1、组合execution

@Pointcut(
            "execution(* cn.esign.epaas.seals.physical.server.controller..*.*(..)) && !execution(* cn.esign.epaas.seals.physical.server.controller..SealHolderController.*(..))")
    private void requestMonitorAspect() {}

2.2、组合pointCut

    // 扫描controller层
    @Pointcut("execution(* com.winup.web.controller..*.*(..)) ")
    public void runningLogPointcat() {
    }

    // 排除controller类
    @Pointcut("execution(* com.winup.web.controller.TempController.*(..)) ")
    public void excludePointcut() {
    }

    //切面配置
    @AfterReturning("runningLogPointcat() && !excludePointcut()")
    public void saveSysLog(JoinPoint joinPoint) throws IOException {
        String className = joinPoint.getSignature().getDeclaringType().getSimpleName();
        String methodName = joinPoint.getSignature().getName();
        logger.info("{}.{} start", className, methodName);
    }
正文到此结束
本文目录