SpringMVC版本报错解决办法
小法贼溜 人气:1报错代码:
1 <?xml version="1.0" encoding="UTF-8"?> 2 <beans xmlns="http://www.springframework.org/schema/beans" 3 xmlns:context="http://www.springframework.org/schema/context" 4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 5 xsi:schemaLocation=" 6 http://www.springframework.org/schema/beans 7 http://www.springframework.org/schema/beans/spring-beans.xsd 8 http://www.springframework.org/schema/context 9 http://www.springframework.org/schema/context/spring-context.xsd"> 10 <context:component-scan base-package="cn.aynu.spring.controller"/> 11 12 </beans>
提示错误:
The errors below were detected when validating the file "spring-beans-4.3.xsd" via the file "springmvc-config.xml". In most cases these errors can be detected by validating "spring-beans-4.3.xsd" directly. However it is possible that errors will only occur when spring-beans-4.3.xsd is validated in the context of springmvc-config.xml.译文:在验证文件“spring-beans-4.3”时检测到以下错误。通过文件“springmvc-config.xml”创建xsd。在大多数情况下,可以通过验证“spring-beans-4.3”来检测这些错误。xsd直接”。然而,也有可能只有在spring-beans-4.3时才会发生错误。xsd在springmvc-config.xml上下文中进行了验证。
解决方案:增加spring-beans.xsd版本号,此项目用的是spring4.3.6,修改后代码如下:
1 <?xml version="1.0" encoding="UTF-8"?> 2 <beans xmlns="http://www.springframework.org/schema/beans" 3 xmlns:context="http://www.springframework.org/schema/context" 4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 5 xsi:schemaLocation=" 6 http://www.springframework.org/schema/beans 7 http://www.springframework.org/schema/beans/spring-beans-4.3-6.xsd 8 http://www.springframework.org/schema/context 9 http://www.springframework.org/schema/context/spring-context-4.3-6.xsd"> 10 <context:component-scan base-package="cn.aynu.spring.controller"/> 11 12 </beans>
总结:此类报错为xsd版本问题,若代码本身有版本号报错,可尝试删除版本号,或更改版本号
加载全部内容