1.首先编写一个自定义注解
package com.ssm.logAop;
import java.lang.annotation.*;
@Target({ElementType.METHOD,ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface MethodLog {
String remark() default "";
String operType() default "0";
}
2.定义切点为自定义注解
@Component
@Aspect
public class LogService {
@Autowired
private LogDao logDao;
public LogService() {
super();
}
/**
* 切点
*/
@Pointcut("@annotation(com.ssm.logAop.MethodLog)")
public void methodCachePointcut() {}
3.切面实现
/**
* 切面