【问题标题】:Why is version-less spring-security.xsd missing on http://www.springframework.org/schema/security?为什么 http://www.springframework.org/schema/security 上缺少无版本 spring-security.xsd?
【发布时间】:2016-10-03 11:01:23
【问题描述】:

在我们基于 Spring 的应用程序中,我们使用来自位于 http://www.springframework.org/schema/security/spring-security.xsd 的命名空间 http://www.springframework.org/schema/security 的元素来补充应用程序上下文文件:

<beans ...
       xmlns:security="http://www.springframework.org/schema/security"
       ...
       xsi:schemaLocation="...
        http://www.springframework.org/schema/security
        http://www.springframework.org/schema/security/spring-security.xsd"> ... </beans>

但是,最近我们收到了这个错误信息

Multiple annotations found at this line:
            - cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'security:global-method-security'.
            - schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/security/spring-security.xsd', because 1) could not 
             find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.

在我们的项目初始设置后或清除 Eclipse 的网络缓存后,在 Eclipse 的 XML 编辑器中打开应用程序上下文文件时。

对 archive.org 的进一步研究表明,当当前版本 (spring-security-4.1.xsd) 于 2016 年 3 月 8 日左右发布时,无版本 XSD 已被删除。

有没有人知道这是否是偶然发生的,或者是否有更深层的原因导致移除?对于其他命名空间,springframework.org/schema/ 上仍有可用的无版本 XSD,即 spring-security-oauth.xsd 和 spring-beans.xsd。 (由于我的声誉等级低,我无法发布指向他们的明确链接。)

作为一种解决方法,我们现在引用一个版本化的 XSD。然而,到目前为止,我的印象是 Spring 鼓励使用无版本 XSD,例如 current Spring security reference documentationthis SO post 中所建议的。

【问题讨论】:

  • 因为使用架构而不指明您想要的架构的哪个版本不是一个好主意?
  • @vzamanillo:感谢您提供实际链接。
  • @Raedwald:不确定我是否应该同意这种情况,因为 Spring 似乎鼓励使用无版本 XSD。

标签: java xml eclipse spring spring-security


【解决方案1】:

事实证明,与此同时,Spring 维护人员已将无版本的 spring-security.xsd 添加到 http://springframework.org/schema/security。这一次,它与 spring-security-4.1.xsd 匹配。修复它的人:谢谢!

【讨论】:

    猜你喜欢
    • 2023-02-23
    • 2022-07-04
    • 2014-12-04
    • 2011-01-10
    • 2011-11-03
    • 2015-11-01
    相关资源
    最近更新 更多