java - 關于aop在controller不起用的問題
問題描述
我想在controller攔截接口的訪問次數(shù),結果都不沒有用,下面是我的代碼
@Component@Aspect@EnableAspectJAutoProxy(proxyTargetClass = true)public class EduAspect { private final static Logger LOGGER = LoggerFactory.getLogger(EduAspect.class); //我想攔截sample包下所有以.Controller結尾的方法,但是攔截不到 @Pointcut('execution(* com.sample..*Controller.*(..))') public void declareLoggerJoinPointExpression() { } @Pointcut('@annotation(com.sample.common.annotation.Frequency)') public void declareFrequencyJoinPoint(){ }
代碼就是上面的這樣,但是好像一直aop不管用,我也開啟了cglib
問題解答
回答1:你這還沒寫完吧.....
你只是聲明了是切入點. 但是沒有通知執(zhí)行啊.
具體如何配置可詳見; http://docs.spring.io/spring/...
相關文章:
