栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

没有互联网连接时,Spring schemaLocation失败

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

没有互联网连接时,Spring schemaLocation失败

如果正确配置了名称空间且XSD文件位于类路径中,则无需在schemaLocation URL中使用classpath:协议。

Spring doc“ 注册处理程序和模式 ”显示了应如何完成。

在你的情况下,问题可能出在你的类路径上的spring-context jar不是2.1。这就是将协议更改为类路径的原因:并将特定的2.1 XSD放在类路径中可以解决此问题。

从我所看到的,在spring- * jar中为主XSD定义了2个模式。一次使用版本解析模式URL,一次不使用版本解析模式URL。

例如,请参阅spring-context-3.0.5.RELEASE.jar中spring.schemas内容的这一部分:

http://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsdhttp://www.springframework.org/schema/context/spring-context-3.0.xsd=org/springframework/context/config/spring-context-3.0.xsdhttp://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-3.0.xsd

这意味着(在xsi:schemaLocation中)

http://www.springframework.org/schema/context/spring-context-2.5.xsd 

将针对

org/springframework/context/config/spring-context-2.5.xsd 

在类路径中。

http://www.springframework.org/schema/context/spring-context-3.0.xsd 

要么

http://www.springframework.org/schema/context/spring-context.xsd

将针对

org/springframework/context/config/spring-context-3.0.xsd 

在类路径中。

http://www.springframework.org/schema/context/spring-context-2.1.xsd

未定义,因此Spring将使用schemaLocation中定义的文字URL进行查找。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/431992.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号