当我使用 ref 属性定义一个 tasklet 时,一切都很好:
<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.
是豆子,不是吗?
在定义验证器(DefaultJobParametersValidator)时,我得到了同样的奇怪行为。