//args(trackNumber):表明传给playTrack的int参数,也会传给切入点 @Pointcut("execution(* com.zte.sound.service.bean.CompactDisc.playTrack(int))"+" && args(trackNumber)") public void trackPlayed(int trackNumber){} @After("trackPlayed(trackNumber)") public void showCount(int trackNumber){ System.out.println("当前磁道播放了:"+trackNumber+"次"); }
com.zte.sound.service.bean.CompactDisc.playTrack(int num)在被调用时,
所传入的参数num,
作为切面类showCount方法的参数"trackNumber"传入