![](/img/trans.png)
[英]cvc-complex-type.2.4.a: Invalid content was found starting with element 'beans'
[英]cvc-complex-type.2.4.a: Invalid content was found starting with element 'beans:bean'
'{“ http://www.springframework.org/schema/beans”:meta ,“ h ttp://www.springframework.org/schema/beans”:constructor-arg,“ http:// www。”之一。 springframework.org/schema/beans“:property ,” http://www.springframework.org/schema/beans“:qualifier ,” http://www.springframework.or g / schema / beans“:lookup-method, “ http://www.springframework.org/schema/beans ”:替换方法,WC [## other:” http://www.springframework.org/schema/beans “]}”是预期的。
Tomcat向我显示以上错误
我的spring-servlet.xml在下面给出。 我正在使用springframework的3.11.RELEASE版本。
<?xml version="1.0" encoding="UTF-8"?>
<beans:bean xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd">
<context:component-scan base-package="in.project.*" />
<annotation-driven/>
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/views/"/>
<beans:property name="suffix" value=".jsp"/>
</beans:bean>
</beans:bean>
xml应用程序上下文的根实体是<beans>
,而不是<bean>
。 所以你可能最终会
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd">
...
</beans:beans>
还没有测试过,但是应该可以工作。 希望能有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.