切面添加日志
/**
日志切面
*/
@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();
}
人总得做点什么 ,不是么