0
我是springMVC的新手。使用springMVC 4.2.4,Tomacat 9.0,Maven 4.0,Java 1.8,Eclipse IDE,當我嘗試在bean中寫入一個bean時,它顯示一個錯誤。以下是配置xml文件。我在xml中創建bean時出現以下錯誤** cvc-complex-type.2.4.a:發現以元素'bean'開頭的無效內容**
<?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:mvc="http://www.springframework.org/schema/mvc"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<mvc:annotation-driven />
<mvc:resources location="pdfs" mapping="/pdfs/**" />
<context:component-scan base-package="com.springmvc.controller" />
<mvc:interceptors>
<bean
class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"
p:paramName="language" />
</mvc:interceptors>
<bean
class=
"org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="order" value="1" />
<property name="ContentNegotiationManager" />
**<bean**
class="org.springframework.web.accept.ContentNegotiationManager">
<constructor-arg>
<bean
class="org.springframework.
web.accept.PathExtensionContentNegotiationStrategy">
<constructor-arg>
<map>
<entry key="json" value="application/json" />
<entry key="xml" value="application/xml" />
</map>
</constructor-arg>
</bean>
</constructor-arg>
</bean>
<property name="defaultViews">
<list>
<bean
class="org.springframework.web.servlet.view.json.MappingJacksonJsonView"
/>
<bean
class="org.springframework.wweb.servlet.view.xml.MarshallingView">
<constructor-arg>
<bean
class="org.springframework.oxm.xstream.XStreamMarshaller">
<property name="autodetectAnnotations" value="true"
/>
</bean>
</constructor-arg>
</bean>
</list>
</property>
</bean>
</beans>
可以請你分享你看到完整的錯誤 – ScanQR