spring-beans.xsd没有定义“local”。为什么?
几乎每个春季项目都使用spring-beans.xsd(更精确地参考它)。但是,如果您查看该文件,http://www.springframework.org/schema/beans/spring-beans.xsd,您将看到它是版本 3.2,并且没有属性“local”的定义。
更有趣的是,http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 确实定义了“本地”。
此外,由于spring.schema,文件是从jar(org/springframework/beans/factory/xml/spring-beans-3.2.xsd)中提取出来的,我认为任何项目都不会有编译或运行时问题。
另一方面,Eclipse的xml验证器,我认为,它只使用互联网链接,并显示一个xml错误,更具体地说:
“cvc-complex-type.3.2.2:属性'local'不允许出现在元素'ref'中”
这是一个错误吗?
编辑:根据要求,这是我的弹簧标题:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:batch="http://www.springframework.org/schema/batch"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd">
编辑2:这是我使用本地的地方
<bean id="bar"
class="org.springframework.batch.item.support.CompositeItemWriter">
<property name="delegates">
<list>
<ref local="foo" />
</list>
</property>
</bean>
<bean id="foo" class="java.lang.String" />