Reputation: 133
I've tried solving this issue for hours. When I run my code I get an error saying:
cvc-complex-type.2.4.a:Invalid content was found starting with element 'bean' One of '{"http://www.springframework.org/schema/context":include-filter, "http://www.springframework.org/schema/context":exclude-filter}' is expected.
I've looked around alot for answers, some suggestions were that one should make sure the right versions are used. I use the same version in my xml as in my pom file. (I'm using maven with eclipse btw).
Any suggestions on what the problem might be?
<?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>
Upvotes: 1
Views: 17377
Reputation: 4048
<context:component-scan>
should not have <bean>
elements nested within.
Try:
<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" />
Upvotes: 8