2

I have the <mvc:annotation-driven/> annotation which errors out. The error I get is : The matching wildcard is strict, but no declaration can be found for element 'mvc:annotation-driven'.

When I used the beans

<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />

it works fine. How is that possible

My complete Spring context XML file is :

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

    <mvc:annotation-driven/>
</beans>
informatik01
  • 16,038
  • 10
  • 74
  • 104
fastcodejava
  • 39,895
  • 28
  • 133
  • 186

2 Answers2

5

I believe that there is no mvc:annotation-driven annotation in Spring 2.5, I think it was introduced in Spring 3.0. Consider using the current version of Spring.

I could not find the actual http://www.springframework.org/schema/mvc/spring-mvc-2.5.xsd I'm not sure that it even existed.

Community
  • 1
  • 1
Boris Treukhov
  • 17,493
  • 9
  • 70
  • 91
  • 1
    +1. The [Spring documentation](http://docs.spring.io/spring/docs/3.0.x/spring-framework-reference/html/mvc.html#mvc-config) clearly says it (quote, emphasis mine): "**Spring 3 introduces a mvc** XML configuration namespace ...". – informatik01 Dec 06 '13 at 17:46
-1

Missign dependcy spring-webmvc, show your pom

NimChimpsky
  • 46,453
  • 60
  • 198
  • 311