Spring stage study concluded (13) cut point reuse expressions

Package name @before on each method immediately before the () in a large segment of the class name + + method name to make simplified method defines a @pointCut, and other parameters before the parameter annotation, then the annotation parameters in other methods this method can be invoked,

 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     }

 

Guess you like

Origin www.cnblogs.com/zhang188660586/p/11588735.html