/ / cvc-complex-type.2.4.a: Foi encontrado um conteúdo inválido a partir do elemento 'driven por anotação' - spring

cvc-complex-type.2.4.a: Foi encontrado um conteúdo inválido a partir do elemento 'driven por anotação' - spring

Abaixo eu colei meu servlet-context.xml.Estou recebendo o erro no spring toolsuite na linha onde declarei a tag orientada por anotação

cvc-complex-type.2.4.a: Invalid content was found starting with element "annotation-driven". One of "{"http://www.springframework.org/schema/beans":description, "http://
www.springframework.org/schema/beans":import, "http://www.springframework.org/schema/beans":alias, "http://www.springframework.org/schema/beans":bean,
WC[##other:"http://www.springframework.org/schema/beans"]}" is expected.






<?xml version="1.0" encoding="utf-8"?>
<beans:beans xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
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
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

<!-- DispatcherServlet Context: defines this servlet"s request-processing infrastructure -->`enter code here`



<!-- Enables the Spring MVC @Controller programming model -->
<annotation-driven />

<beans:bean id="productManager" class="com.manthan.service.SimpleProductManager">
<beans:property name="products">
<beans:list>
<beans:ref bean="product1"/>
<beans:ref bean="product2"/>
<beans:ref bean="product3"/>
</beans:list>
</beans:property>
</beans:bean>

<context:component-scan base-package="com.manthan.vani" />

</beans:beans>

Eu sou um novato e estou trabalhando na suíte de ferramentas Spring 3.7.0

Respostas:

3 para resposta № 1

Mudança:

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

para

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

ou faça:

<mvc:annotation-driven />

Sua configuração da curreta possui o prefixo "mvc", que não aponta para o namespace padrão e annotation-driven vem do esquema mvc.