首页 > 代码库 > Spring mvc:配置不拦截指定的路径

Spring mvc:配置不拦截指定的路径

    <!-- 访问拦截  -->  
      <mvc:interceptors>
        <mvc:interceptor>
            <mvc:mapping path="/**/**"/>
            <!-- 不拦截的url -->
            <mvc:exclude-mapping path="/wechatController/"/>
            
            <bean class="com.cd.interceptor.LoginHandlerInterceptor"/>
        </mvc:interceptor>
    </mvc:interceptors>
     
因为mvc:exclude-mapping不被http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 支持
所以要改成http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd 
即可.
不然会报错:
cvc-complex-type.2.4.a: Invalid content was found starting with element ‘mvc:exclude-mapping‘. One 
 of ‘{"http://www.springframework.org/schema/mvc":mapping, "http://www.springframework.org/
 schema/beans":bean}‘ is expected.

Spring mvc:配置不拦截指定的路径