首页 文章

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

提问于
浏览
0

其中一个'{“http://www.springframework.org/schema/beans":meta,ht tt://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":replaced-method,WC [## other:”http://www.springframework.org/schema/beans“]}'是预料之中的 .

Tomcat向我显示错误

我的spring-servlet.xml如下所示 . 我正在使用.3.11.RELEASE版本的springframework .

<?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>

1 回答

  • 2

    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>
    

    没有测试但是应该工作 . 希望有所帮助 .

相关问题