org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 39 in XML document from class path resource [spring/web/servlet-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.1: Element 'mvc:annotation-driven' must have no character or element information item [children], because the type's content type is empty.
原先spring包是3.0,替换为3.1即可
<mvc:annotation-driven>
<mvc:message-converters register-defaults="true">
<bean
class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/plain;charset=UTF-8</value>
</list>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
原先spring包是3.0,替换为3.1即可
本文解决了在使用Spring框架配置web上下文时遇到的XmlBeanDefinitionStoreException问题,特别是关于mvc:annotation-driven元素中message-converters配置不当导致的错误。通过替换Spring版本,正确配置message-converters实现了问题的解决。
4万+

被折叠的 条评论
为什么被折叠?



