步骤1: pom.xml添加依赖:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> </dependency>
步骤2: 具体实现如下,实现环绕Around()方法, @Around("excudeUpdateService()"),其中excudeUpdateService()和excudeAddService()指定了拦截的类路径以及方法名,可以使用正则表达式 import com.alibaba.fastjson.JSONObject; import org.apache.commons.lang3.StringUtils; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.springframework.context.annotation.Configuration; import java.util.Date; @Aspect @Configuration public class AopConfig { private static final String CREATOR = "creator"; private static final String CREATE_TIME = "createTime"; private static final S