Spring Tool Suite(3.1.0)/ Eclipse正在加载错误版本的Spring Beans XSD,导致XML验证错误。我在类路径上有spring-beans
3.2.2.RELEASE作为Maven依赖项,因此profile
元素的<beans>
属性应该是允许的。可悲的是,这标志为错误。
<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 Bean版本3.1.4。我不确定如何使用Maven的依赖来覆盖它(可能随时改变)。
答案 0 :(得分:1)
如果您查看Spring jar,您可能会看到3.1.4 xsd也包含在该jar中。在这种情况下,我建议将版本号添加到schemaLocation中的spring-beans.xsd。我在一个可以进行验证的XML编辑器中对此进行了讨论,并发现它有所帮助。
在没有版本号的情况下,XML编辑器会在spring-beans.xsd和spring-beans-3.2.xsd中进行操作,最终验证失败。