package com.zhujizheng.IHome.aop; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.*; import org.springframework.stereotype.Component; import org.springframework.util.Assert; import java.util.concurrent.ConcurrentHashMap; @Component @Aspect @Slf4j public class ApiIdempotentAspect { private String around = "ApiIdempotentAspect.around"; private String pointcut = "@annotation(apiIdempotent)"; @Pointcut("@annotation(apiIdempotent)") public void pointCut(ApiIdempotent apiIdempotent) {} @Around(value = "pointCut(apiIdempotent)") public void around(ProceedingJoinPoint joinPoint, ApiIdempotent apiIdempotent) throws Throwable { log.error(System.currentTimeMillis() + ""); joinPoint.proceed(); log.error(System.currentTimeMillis() + ""); } }