Spring的Aspect切面类不能拦截Controller中的方法
根本原因在于<aop:aspectj-autoproxy />这句话是在spring的配置文件内,还是在springmvc的配置文件内。如果是在spring的配置文件内,则@Controller中的方法不会被拦截。 看一下applicationContext.xml中bean扫描的配置,此处排除了controller层的扫描: <context:component-scan base-package="com"> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" /> </context:component-scan> <context:component-scan base-package="icom"> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" /> </context:component-scan> 看一下springmvc-servlet.xml中bean扫描的配置,此处排除了service层的扫描: <context:component-scan base-package=