import org.aspectj.lang.annotation.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @Aspect public class LoggingAspect { private static final Logger logger = LoggerFactory.getLogger(LoggingAspect.class); @Before("execution(* com.example.MyClass.*(..))") public void logMethodExecution() { logger.info("Method execution started"); } @AfterReturning("execution(* com.example.MyClass.*(..))") public void logMethodReturn() { logger.info("Method execution returned"); } }


上一篇:
下一篇:
切换中文