xml:
- XML code
<bean id="chkLoginAdvice" class="com.zjm.study.advice.chkLoginAdvice" /> <aop:config> <aop:advisor pointcut="execution(* com.zjm.struts.action.LoginAction.login(..))" advice-ref="chkLoginAdvice" /> </aop:config>
action:
- Java code
package com.zjm.struts.action;public class LoginAction extends DispatchAction { //分发action public ActionForward login(ActionMapping mapping............) { //......... }}
around拦截器:
- Java code
package com.zjm.study.advice;public class chkLoginAdvice implements MethodInterceptor { public Object invoke(MethodInvocation arg0) throws Throwable { System.out.println("测试拦截"); //这句没打印出来,没拦住..... return null; }}
没拦住啊,拦截器里打印的“测试拦截”,控制台没有
------解决方案--------------------
好像spring的aop拦截不到继承自dispathcerAction的方法