Aspect 用于方法出入口日志记录

JAVA学习网 2017-07-18 06:08:01
@Aspect
public class Aspect
{

    @Before("execution(* com.test.*.*(..))")
    public void logBefore(JoinPoint joinPoint)
    {
        logEnter.....
    }

    @After("execution(* com.test.*.*(..))")
    public void logAfter(JoinPoint joinPoint)
    {
         logExit.....
    }
}

Spring config:

<aop:aspectj-autoproxy/>
    
<bean id="aspect" class="com.test.Aspect"></bean>

 

阅读(794) 评论(0)