本文主要是介绍Spring配置文件中xsd版本号的问题,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
今天将以前的一个项目移植到新机器上开发,在原本的机器上跑得好好的项目移植过来之后报了个莫名其妙的错:
在xml中给我说xsd的版本不对,于是将原本的如下代码片:
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
之中的版本号统统去掉,使用本地jar中自带的xsd版本,遂成功。
更改之后的代码如下:
xsi:schemaLocation="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.xsd http://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc.xsd">
如此,默认不使用网络上下载的xsd文件,理论上较为优雅,且可以防止断网时应用无法启动、开源软件更换域名时无法启动、项目转移时出现乱七八糟的问题等情况。
这篇关于Spring配置文件中xsd版本号的问题的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!