Use AOP to process user and administrator logs
Because when we generally process the logs of users or administrators, the return values are generally two kinds: string (page), map (string, object),
so we can write a slice to deal with these two situations separately, pay attention to cut range
, for example, the following two cases treated, so can be more convenient handling when users and administrators log error handling, and error value returned.
and the controller layer can be simply thrown.
/**
* 定义一个方法, 用于声明切入点表达式. 一般地, 该方法中再不需要添入其他的代码.
* 使用 @Pointcut 来声明切入点表达式.
* 后面的其他通知直接使用方法名来引用当前的切入点表达式.
*/
@Pointcut("execution(String com.hgh.spring.aop.annotation.ArithmeticCalculator.*(..))")
public void loggingPointcut(){}
/**
* 定义一个方法, 用于声明切入点表达式. 一般地, 该方法中再不需要添入其他的代码.
* 使用 @Pointcut 来声明切入点表达式.
* 后面的其他通知直接使用方法名来引用当前的切入点表达式.
*/
@Pointcut("execution(Map<String,Object> com.hgh.spring.aop.annotation.ArithmeticCalculator.*(..))")
public void loggingPointcut(){}