切面添加日志

/**
日志切面
*/
@Component
@Aspect
@Slf4j
public class LogAspect {

@Pointcut("@annotation(com.lwb.a.utils.aLog)")
public void pointCut() {
}

@After(value = "pointCut()")
public void doCache(JoinPoint joinPoint) {
//MethodSignature signature = (MethodSignature) joinPoint.getSignature();
// Method method = signature.getMethod();
//RmOperationLog annotation = method.getAnnotation(RmOperationLog.class);
//Object[] args = joinPoint.getArgs();
try {

saveLog();
}catch (Exception e){
log.error("保存日志切面方法异常,{}",e.getMessage());
}
}
}

@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface RmOperationLog {
String id() default "";
String ids() default "";
String operatorName();
}
posted @ 2021-06-17 16:24  java_小跟班  阅读(184)  评论(0编辑  收藏  举报