spring aop指定切面


        
            org.springframework
            spring-context
            4.3.16.RELEASE
        
        
            org.aspectj
            aspectjweaver
            1.8.7
        
    
public class Log {
    public void before(){
        System.out.println("aop before");
    }
}
 
    
    
        
            
        
    

解释
每次执行Hello类中的aop方法都会触发切面Log类中的before方法先执行

@Pointcut("execution(* com.cjm.model..*.*(..))")

切面方法

package org.spring;

public class Log {
    public void before(){
        System.out.println("aop before");
    }
    public void after(){
        System.out.println("aop after");
    }
    public void exp(){
        System.out.println("aop ex");
    }
    public void fina(){
        System.out.println("aop fina");
    }

}

            
            
            
            
        

你可能感兴趣的:(spring aop指定切面)