实际操作AOP的时候,出现AOP对Controller无效的情况。
要点: Controller中的方法是在【DispatcherServlet】中被调用
解决办法如下:
在【xxx-yyy.xml】中追加
<aop:aspectj-autoproxy />
xxx-yyy.xml的位置如下:
<servlet>
<servlet-name>aaa</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:/xxx-mvc.xml</param-value>