I am trying to use AOP to do some processing after an annotated controller. Everything is running with no errors, but the advice is not being executed.
Here is the
I had the same problem where advice for Repository was working, but advice for Controller was not. Finally I found a solution. In short, you need to make sure your AOP definition is loaded in Servlet context, not a different context.
In my case, my Spring AOP definition is defined in tools-config.xml. After moving it from here
contextConfigLocation
classpath:spring/tools-config.xml
org.springframework.web.context.ContextLoaderListener
to here,
petclinic
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:spring/mvc-core-config.xml, classpath:spring/tools-config.xml
1
the advice for Controller is working.