今天项目中需要加springMVC拦截器,但是加上了不起作用,我仔细查看了一下,原来是因为在springmvc.xml文件中配置的这个<mvc:annotation-driven/> 配置文件导致的拦截器失效, 我把这个注释掉,改成原始的包扫描的方式获取controller,就起作用了.改成如下这种
<context:component-scan base-package="com.baidu.controller" use-default-filters="false">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>