找到了无效的内容,从元素'资源'开始。 ' {" http://www.springframework.org/schema/beans"预期

时间:2016-09-21 00:56:52

标签: spring-ws

cvc-complex-type.2.4.a: Invalid content was found starting with element 'resources'. One of '{"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"], 
 "http://www.springframework.org/schema/beans":beans}' is expected.

我收到了上述错误。请帮帮我..看下面的文件:

<context:component-scan base-package="com.blog.samples.services" /> <sws:annotation-driven /> <resources mapping="/resources/**" location="/resources/" />

1 个答案:

答案 0 :(得分:1)

我添加了下面的行,它工作正常...

<mvc:resources mapping="/resources/**" location="/resources/" />

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:sws="http://www.springframework.org/schema/web-services"
        xmlns:mvc="http://www.springframework.org/schema/mvc"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
                            http://www.springframework.org/schema/beans/spring-beans.xsd
                            http://www.springframework.org/schema/mvc
                            http://www.springframework.org/schema/mvc/spring-mvc.xsd
                            http://www.springframework.org/schema/web-services
                            http://www.springframework.org/schema/web-services/web-services.xsd
                            http://www.springframework.org/schema/context
                            http://www.springframework.org/schema/context/spring-context.xsd">


    <context:component-scan base-package="com.blog.samples.services" />
    <sws:annotation-driven />

    <mvc:resources mapping="/resources/**" location="/resources/" />

    <!--
         test service bean
    -->
    <bean id="AnimalDetailsService" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition" lazy-init="true">
        <property name="schemaCollection">
            <bean class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
                <property name="inline" value="true" />
                <property name="xsds">
                    <list>
                        <value>schemas/AnimalDetailsServiceOperations.xsd</value>
                    </list>
                </property>
            </bean>
        </property>
        <property name="portTypeName" value="AnimalDetailsService"/>
        <property name="serviceName" value="AnimalDetailsServices" />
        <property name="locationUri" value="/endpoints"/>
    </bean>

</beans>
相关问题