cvc-complex-type.2.4.a:从元素'bean'开始发现无效内容

agi*_*pro 1 java spring xsd

我已经尝试了几个小时来解决这个问题.当我运行我的代码时,我得到一个错误说:

cvc-complex-type.2.4.a:从元素'bean'开始发现无效内容'{" http://www.springframework.org/schema/context "之一:include-filter," http:// www .springframework.org/schema/context ":exclude-filter}'是预期的.

我环顾四周寻找答案,一些建议是确保使用正确的版本.我在我的xml中使用与我的pom文件中相同的版本.(我正在使用maven和eclipse btw).

有关问题可能是什么的任何建议?

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns:context="http://www.springframework.org/schema/context" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://www.springframework.org/schema/beans" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-3.2.7.xsd
    http://www.springframework.org/schema/context 
    http://www.springframework.org/schema/context/spring-context-3.2.7.xsd">
    <context:component-scan base-package="org.mywebbapp.filemanagement">

    <bean
        class="org.springframework.beans.factory.config.ServiceLocatorFactoryBean"
        id="FileStoreFactory">
        <property name="FileStore"
            value="org.mywebbapp.filemanagement.FileStoreFactory">
        </property>
    </bean>
    <alias alias="FH" name="FileHandler" />
</context:component-scan>
</beans>
Run Code Online (Sandbox Code Playgroud)

sam*_*wis 8

<context:component-scan>不应该有<bean>嵌套的元素.

尝试:

<context:component-scan base-package="org.mywebbapp.filemanagement"/>

<bean class="org.springframework.beans.factory.config.ServiceLocatorFactoryBean"
    id="FileStoreFactory">
    <property name="FileStore"
        value="org.mywebbapp.filemanagement.FileStoreFactory">
    </property>
</bean>
<alias alias="FH" name="FileHandler" />
Run Code Online (Sandbox Code Playgroud)