zoukankan      html  css  js  c++  java
  • Spring阶段性学习总结(十 三)重用切点表达式

    即将之前的每个方法上的@before ()里大段的包名+类名+方法名做简化,定义一个@pointCut的方法,参数是之前其他注解的参数,然后在其他方法的注解参数中 调用该方法即可,

     1     @Pointcut("execution(public int SpringAopImp.CalculatorImp.add(int ,int))")
     2     public void declearExpresion(){}
     3     //前置通知在目标方法开始前执行
     4 
     5     @Before("declearExpresion()")
     6     public void beforeMethod(JoinPoint joinPoint) {
     7         String methodName = joinPoint.getSignature().getName();
     8         List<Object> args = Arrays.asList(joinPoint.getArgs());
     9         System.out.println("The Method:" + methodName + " beginWith:" + args);
    10     }
  • 相关阅读:
    CodeForces
    POJ
    POJ 2260 Error Correction 模拟 贪心 简单题
    POJ
    HDU
    UVA
    CodeForces
    CodeForces
    常见的医学图像成像(总)
    ADNI数据集相关概念整理
  • 原文地址:https://www.cnblogs.com/zhang188660586/p/11588735.html
Copyright © 2011-2022 走看看