首先写好一个工具类 LogAspect.java
package com.yangjf.commons;
import java.lang.reflect.Method;
import java.util.Date;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import com.yangjf.entity.Admin;
import com.yangjf.entity.Log;
import com.yangjf.service.LogService;
@Aspect
public class LogAspect {
public Integer id=null;
@Autowired
LogService logService;
/**
* 管理员登录方法的切入点
*/
@Pointcut("execution(* com.yangjf.service.*.login(..))")
public void loginCell(){
}
/**
* 添加业务逻辑方法切入点
*/
@Pointcut("execution(* com.yangjf.service.*.save(..))")
public void insertCell() {
}
/**
* 修改业务逻辑方法切入点
*/
@Pointcut("execution(* com.yangjf.service.*.update(..))")
public void updateCell() {
}
/**
* 删除业务逻