Invalid content was found starting with element 'mvc:exclude-mapping'.

问题?Invalid content was found starting with element 'mvc:exclude-mapping'.


这是springmvc中显著的错误,在配置拦截器的时候,会用到不拦截某一些请求

如:

  1. mvc:interceptors>   
  2. <span style="white-space:pre">    </span>mvc:interceptor>   
  3. <span style="white-space:pre">        </span>mvc:mapping path=”/**”/>//过滤全部请求   
  4. <span style="white-space:pre">        </span>mvc:exclude-mapping path=”/hello.html”/> //除了hello这个请求   
  5. <span style="white-space:pre">        </span>bean class=”net.spring.interceptor.TestInterceptor” />   
  6. <span style="white-space:pre">    </span></mvc:interceptor>   
  7. </mvc:interceptors>   


< mvc:exclude-mapping path=”/hello.html”/>
//除了hello这个请求 

这条语句就会出问题?会报以上的错误,Invalid content was found starting with element 'mvc:exclude-mapping'.原因是:mvc:exclude-mapping 标签不被spring-mvc-3.0.xsd支持,该配置在spring-mvc-3.2.xsd中支持。

把http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd改成http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd

原文地址:https://www.cnblogs.com/toSeeMyDream/p/5805465.html