Dear Spring Forum,
I have some Spring MVC controllers subclassing from an abstract controller:
I am trying to add some advice when the handleRequest() method of a specific subclass executes:Code:public abstract class AbstractController implements Controller { @Override public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) { ... } } public class ConcreteController1 extends AbstractController { ... } public class ConcreteController2 extends AbstractController { ... }
This configuration does not cause the advice to be executed.Code:<aop:aspect id="viewSwitchAspect" ref="viewSwitchAdvice"> <aop:before method="assignView" pointcut="execution(* web.controller.ConcreteController1.handleRequest(..))"/> </aop:aspect>
But this advice does:
My guess is that the reason is that the handleRequest() method is implemented in the abstract superclass. I don't want ConcreteController2 to receive this advice.Code:<aop:aspect id="viewSwitchAspect" ref="viewSwitchAdvice"> <aop:before method="assignView" pointcut="execution(* web.controller.*.handleRequest(..))"/> </aop:aspect>
How can I achieve this?
Thanks,
Stewart


Reply With Quote