cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mvc:annotation-driven' error

后端 未结 2 1370
攒了一身酷
攒了一身酷 2021-01-01 20:49

I have added the spring-security-config-3.1.0.RC3.jar in my lib folder and i still get this error. What can be possible reason ??

Here is my dispatcher-servlet.xml

2条回答
  •  感情败类
    2021-01-01 21:14

    You have this:

    xmlns:mvc="http://www.springframework.org/schema/mvc"
    

    but you're not mentioning it here:

    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">
    

    To fix that, you should have

    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
    

    there as well, like

    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">
    

    Note: it is actually common that schema references don't mention Spring version to allow for easier upgrading, so you should use references like http://www.springframework.org/schema/context/spring-context.xsd instead of the ones having -3.0 in the name.

提交回复
热议问题