/ / cvc-complex-type.2.4.a: Un contenu non valide a été trouvé en commençant par l'élément 'annotation-driven' - spring

cvc-complex-type.2.4.a: Un contenu non valide a été trouvé en commençant par l'élément 'annotation-driven' - spring

Ci-dessous, j'ai collé mon fichier servlet-context.xml.L'erreur apparaît dans la suite d'outils printanière dans la ligne où j'ai déclaré la balise pilotée par l'annotation

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>

Je suis un débutant et je travaille sur la suite d'outils Spring 3.7.0.

Réponses:

3 pour la réponse № 1

Changement:

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

à

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

ou faire:

<mvc:annotation-driven />

Votre configuration actuelle a le préfixe "mvc" qui ne pointe pas vers l’espace de nom par défaut et annotation-driven vient du schéma MVC.