【问题标题】:STS/Eclipse Loading Wrong Spring Beans XSDSTS/Eclipse 加载错误的 Spring Beans XSD
【发布时间】:2013-04-26 12:11:08
【问题描述】:

Spring Tool Suite (3.1.0)/Eclipse 正在加载错误版本的 Spring Beans XSD,导致 XML 验证错误。我在类路径上有spring-beans 3.2.2.RELEASE 作为Maven 依赖项,因此<beans> 元素的profile 属性应该是允许的。遗憾的是,这标记为错误。

<beans xmlns="http://www.springframework.org/schema/beans"
   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">


<beans profile="!cloud">
[...]

以下在我的 XML 目录设置中,并建议将分辨率设置为 Spring Beans 版本 3.1.4。我不确定如何使用来自 Maven 的依赖项来覆盖它(可能随时更改)。

【问题讨论】:

    标签: xml eclipse spring xsd sts-springsourcetoolsuite


    【解决方案1】:

    如果您查看 Spring jar,您可能会看到 3.1.4 xsd 也包含在该 jar 中。在这种情况下,我建议将版本号添加到 schemaLocation 中的 spring-beans.xsd。我在一个可以进行验证的 XML 编辑器中胡思乱想,发现它有帮助。

    在没有版本号的情况下,XML 编辑器拉入 spring-beans.xsd 和 spring-beans-3.2.xsd,最终验证失败。

    【讨论】:

    • 谢谢,但遗憾的是,该项目的技术负责人不允许schemaLocation 中的数字。
    • 我能理解。我通常将它们排除在外,除非我试图解决其中一种奇怪的情况。让我猜猜,它只发生在你的机器上?然后我会查看 Eclipse 设置。当您在命令行上运行 Maven 时它是否有效?查看 Maven 版本和项目 POM。如果有什么安慰的话,我讨厌这些类型的问题。
    猜你喜欢
    • 2020-05-15
    • 1970-01-01
    • 2017-06-17
    • 2015-03-02
    • 1970-01-01
    • 2012-05-27
    • 2012-09-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多