cvc-complex-type.2.4.a:从元素'注释驱动的'开始发现无效的内容。

时间:2015-07-07 10:51:16

标签: spring

下面我已经粘贴了我的servlet-context.xml。我在Spring工具套件中收到错误,我在该行中声明了注释驱动标记

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>

我是初学者并致力于Spring工具套件3.7.0

1 个答案:

答案 0 :(得分:4)

变化:

SELECT physical_name 
FROM sys.database_files 
WHERE [type] = 0

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

或制作:

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

您的当前配置的前缀为“mvc”,它不指向默认命名空间,而<mvc:annotation-driven /> 来自mvc架构。