AbstractTraceAspect.java
上传用户:dezhong
上传日期:2022-08-10
资源大小:167k
文件大小:1k
源码类别:

Java编程

开发平台:

Java

  1. package org.springframework.samples.petclinic.aspects;
  2. import org.apache.commons.logging.Log;
  3. import org.apache.commons.logging.LogFactory;
  4. import org.aspectj.lang.JoinPoint;
  5. import org.aspectj.lang.annotation.Aspect;
  6. import org.aspectj.lang.annotation.Before;
  7. import org.aspectj.lang.annotation.Pointcut;
  8. /**
  9.  * Aspect to illustrate Spring-driven load-time weaving.
  10.  *
  11.  * @author Ramnivas Laddad
  12.  * @since 2.5
  13.  */
  14. @Aspect
  15. public abstract class AbstractTraceAspect {
  16. private static final Log logger = LogFactory.getLog(AbstractTraceAspect.class);
  17. @Pointcut
  18. public abstract void traced();
  19. @Before("traced()")
  20. public void trace(JoinPoint.StaticPart jpsp) {
  21. if (logger.isTraceEnabled()) {
  22. logger.trace("Entering " + jpsp.getSignature().toLongString());
  23. }
  24. }
  25. }