⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 logbeforeadvice.java

📁 spring2.0技术手册随书事例,结合例子学习起来更轻松
💻 JAVA
字号:
package onlyfun.caterpillar;

import java.util.logging.Level;
import java.util.logging.Logger;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;

@Aspect
public class LogBeforeAdvice { 
    private Logger logger = 
            Logger.getLogger(this.getClass().getName()); 
    
    @Before("execution(* onlyfun.caterpillar.IHello.*(..))" )
    public void before(JoinPoint jointPoint) { 
        logger.log(Level.INFO, 
            "method starts..." +
            jointPoint.getSignature().getDeclaringTypeName() + 
            "." + jointPoint.getSignature().getName()); 
   } 
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -