cvc-complex-type.2.4.c:匹配的通配符是strict,但是找不到元素’mvc:annotation-driven’错误的声明
我在我的lib文件夹中添加了spring-security-config-3.1.0.RC3.jar,但仍然出现此错误。 可能的原因是什么?
这是我的dispatcher-servlet.xml
你有这个:
xmlns:mvc="http://www.springframework.org/schema/mvc"
但你在这里没有提到它:
xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
要解决这个问题,你应该有
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
就像那样
xsi:schemaLocation=" http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
注意:模式引用实际上通常不提及Spring版本以便于升级,因此您也可以使用http://www.springframework.org/schema/context/spring-context.xsd
引用。