cvc-complex-type.2.4.a:从元素'拦截器'Spring开始发现无效内容

use*_*974 1 spring-mvc spring-security

我检查了几个类似的问题,但没有一个可以解决我的问题.我在我的spring xml配置文件中添加了拦截器,它给我上面提到的错误.

我的xml形成如下所示 -

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
....
...

    <mvc:annotation-driven .. />
    <bean id="transactionManager"
        ...
        ...

    </bean>
    <bean id="diffrent id"
        ...
        ...

    </bean>
    <bean id="diffrent id"
        ...
        ...

    </bean>

    // added interceptor below
    <interceptors>
            <mapping path="/*"/>
            <bean class="path of class" ></bean>
    </interceptors>
    <context:component-scan base-package="pacakge path" />
</beans>
Run Code Online (Sandbox Code Playgroud)

你能帮我解决一下如何解决这个问题.提前致谢.

Ami*_*har 8

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
   http://www.springframework.org/schema/beans     
   http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
   http://www.springframework.org/schema/mvc
   http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd">



<mvc:interceptors>
<mvc:interceptor>
  <mvc:mapping path="/**"/>
  <bean id="localeChangeInterceptor"
   class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
   <property name="paramName" value="j_lang" />
  </bean>
</mvc:interceptor>

 </mvc:interceptors>
Run Code Online (Sandbox Code Playgroud)