简体   繁体   中英

STS/Eclipse Loading Wrong Spring Beans XSD

Spring Tool Suite (3.1.0)/Eclipse is loading the wrong version of a Spring Beans XSD, causing XML validation errors. I've got spring-beans 3.2.2.RELEASE on the classpath as a Maven dependency, and so the profile attribute of the <beans> element should be permissable. Sadly, this flags as an error.

<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">
[...]

The following is in my XML Catalog settings, and suggest something is setting resolution to version 3.1.4 of Spring Beans. I'm not really sure how I can override this with a dependency from Maven (that could change at any time).

在此处输入图片说明

If you look in the Spring jar you will probably see that the 3.1.4 xsd is also included in that jar. In this case I would suggest adding the version number to the spring-beans.xsd in the schemaLocation. I monkeyed around with this in an XML editor that could do validation, and found that it helped.

With out the version number the XML editor was pulling in the spring-beans.xsd and the spring-beans-3.2.xsd, and ended up failing validation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM