ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
~~~ @Component("logger") @Aspect //表示当前类是一个切面类 public class Logger { @Pointcut("execution(* com.test.service.impl.*.*(..))") public void pt1(){} @Before("pt1()") public void beforePrintLog(){ System.out.println("before 记录日志............"); } @AfterReturning("pt1()") public void afterReturingPrintLog(){ System.out.println("afterReturingPrintLog 记录日志............"); } @AfterThrowing("pt1()") public void exceptionPrintLog(){ System.out.println("exceptionPrintLog 记录日志............"); } @After("pt1()") public void afterPrintLog(){ System.out.println("afterPrintLog 记录日志............"); } } ~~~