我正在尝试将我的spring 3.4应用程序升级到spring 4.0.2
我导入了所有spring-4.0.2 jar文件但是在dispatcher-servlet.xml中出现错误
如果我使用此代码,我会得到Referenced文件包含错误(http://www.springframework.org/schema/beans/spring-beans-4.0.xsd)
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<!-- automatic scan base folder to detect controllers -->
<context:component-scan base-package="com.shaw.csdss"/>
<mvc:annotation-driven />
<!-- This file will contain the view name mappings to the jsp -->
<bean id = "jspViewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
<property name="prefix"><value>/</value></property>
<property name="suffix"><value>.jsp</value></property>
<property name="order" value="1" />
</bean>
</beans>
我试图从xsd引用中删除-4.0但是我现在在spring-mvc-xsd上得到了同样的错误。
我甚至试图丢弃所有内容,只需从弹簧参考文档中复制xml,如下所示
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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">
<mvc:annotation-driven />
<bean id = "jspViewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
<property name="prefix"><value>/</value></property>
<property name="suffix"><value>.jsp</value></property>
<property name="order" value="1" />
</bean>
</beans>
但是使用这个简单的文件我会收到错误
cvc-complex-type.2.4.c:匹配的通配符是严格的,但是没有找到元素'mvcannotation-driven
的声明我从spring4.0参考文档中获取的任何示例都给出了同样的错误。
这是spring4.0.2的问题还是我错过了什么?
感谢您的帮助