spring aop 如何切面到mvc 的controller, service

Spring+SpringMVC+Mybatis 利用AOP自定义注解实现可配置日志快照记录http://unkeltao.com/blog/2014/07/22/spring-plus-springmvc-plus-mybatis-aop/
基于注解的Spring AOP的配置和使用  http://my.oschina.net/sniperLi/blog/491854
Spring中的AOP(五)——在Advice方法中获取目标方法的参数 http://my.oschina.net/itblog/blog/211693, 这里有aop的更多知识

拦截Controller
http://yjian84.iteye.com/blog/1920787

Indeed your controller (annotated by @Controller) and your aspects (annotated by @Aspect) should be in the same Spring context.

Usually people define their controllers in the dispatch-servlet.xml or xxx-servlet.xml and their service beans (including the aspects) in the main applicationContext.xml. It will not work.

When Spring initializes the MVC context, it will create a proxy for your controller but if your aspects are not in the same context, Spring will not create interceptors for them.

这个人说的好像很对啊。我把aspectj 和springmvc的配置文件放到一起就可以用到controller上了。

在servlet.xml加入

sysLogAspectJ

拦截Service等
在applicationContext.xml(扫描service的类的配置文件)加入