如何使用spring.schemas和spring.handler来短路依赖项的模式查找

时间:2013-10-16 19:04:10

标签: spring mule

我正在尝试将https://github.com/mulesoft/mule-module-cache升级为在Mule 3.4.0 CE下运行但在命令行上运行mvn clean install时获取以下内容

[10-16 13:51:05] WARN  XmlBeanDefinitionReader [main]: Ignored XML validation warning org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans-current.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>.
....
testExternalGenerator(org.mule.module.cache.ExpressionTest): Line 6 in XML document from URL [jar:file:/Users/me/.m2/repository/org/mule/modules/mule-module-spring-config/3.4.0/mule-module-spring-config-3.4.0.jar!/mule-spring-config.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'. (org.mule.api.lifecycle.InitialisationException)

这是由于使用current的mule-module-spring-config-3.4.0.jar的mule-spring-config.xml声明。如果这是我的配置文件,我会修改文件以明确指向我想要的URI,但是,唉,事实并非如此。这是第6行:

xsi:schemaLocation="
   http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd"

我有没有办法使用Spring handler/schema approach当前指向 3.1

http:\//www.springframework.org/schema/beans/spring-beans-current.xsd=META-INF/spring-beans-3.1.xsd

或者我需要采取不同的方法吗?

2 个答案:

答案 0 :(得分:0)

当前Spring Beans架构的URI是:

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

http://www.springframework.org/schema/beans/spring-beans-current.xsd

答案 1 :(得分:0)

如果我理解了您的问题,那么您将创建一个名为 spring.schemas 的文件,将其存储在WAR或EAR文件的 META-INF 目录中并拥有它包含以下条目:

http:\//www.springframework.org/schema/beans/spring-beans-current.xsd=http://www.springframework.org/schema/beans/spring-beans-3.1.xsd

如果您不想从互联网上获取XSD,请添加以下条目:

http:\//www.springframework.org/schema/beans/spring-beans-current.xsd=org/springframework/beans/factory/xml/spring-beans-3.1.xsd

第二个假设适当的spring-beans.jar在你的类路径中。据我所知,最后一个选项是改变SpringConfig.xml文件中的条目:

xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd"

xsi:schemaLocation=" http://www.springframework.org/schema/beans classpath:org/springframework/beans/factory/xml/spring-beans-3.1.xsd"