当我定义使用ref属性一个tasklet,一切都很好:如何将一个tasklet等定义为嵌套bean?
<step id="unzipFiles_010_014" next="verifyXmlSignatures_010_014">
<tasklet ref="unzipTasklet_010_014" />
</step>
然而,对于某些情况下,我想直接嵌套的bean定义bean,如:
<step id="unzipFiles_010_014" next="verifyXmlSignatures_010_014">
<tasklet>
<bean scope="step" class="some.package.UnZipTasklet">
<property name="file" ref="any.file" />
</bean>
</tasklet>
</step>
现在我收到一个奇怪的错误:
cvc-complex-type.2.4.a: Invalid content was found starting with
element 'bean'. One of '{"http://
www.springframework.org/schema/batch":chunk,
"http://www.springframework.org/schema/
batch":transaction-attributes,
"http://www.springframework.org/schema/batch":no-rollback-exception-classes,
"http://www.springframework.org/schema/batch":listeners,
"http://www.springframework.org/schema/ beans":bean,
"http://www.springframework.org/schema/beans":ref}' is expected.
这是一个bean,不是吗?
我定义验证器(DefaultJobParametersValidator)时,得到了同样的奇怪的行为。
不幸的不是。该语法对于step和tasklet是有效的,但是对于bean来说是相同的错误。 – Andy