记录一下springMVC拦截器配置

来源:互联网 发布:生化危机 剧情 知乎 编辑:程序博客网 时间:2024/05/16 04:24

在spring-mvc.xml文件中加上<mvc:interceptors></mvc:interceptors>,

<mvc:interceptors>
<bean id="allInterceptors" class=" com.linkcm.core.base.interceptor.MyInterceptors"></bean>
</mvc:interceptors>

直接配置在interceptors下会拦截所有请求,如果:

<mvc:interceptors>
<bean id="allInterceptors" class=" com.linkcm.core.base.interceptor.MyInterceptors"></bean>

<mvc:interceptor>
<mvc:mapping path="/login/*"/>
<bean></bean>
</mvc:interceptor>

</mvc:interceptors>

配置在interceptor里面只拦截配置的特定请求。

原创粉丝点击