0

ref 属性を使用してタスクレットを定義すると、すべて問題ありません。

<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 )を定義するときに、同じ奇妙な動作が発生しました。

4

2 に答える 2

0

batch: 名前空間で動作する可能性があります。

例えば:

<batch:step id="copyToWorkdir" next="concatStrings">
    <batch:tasklet>
        <bean class="your.tasklet.Class" scope="step">
            <property name="inFile" value="xxx" />
            <property name="outFile" value="xxx" />
        </bean>
    </batch:tasklet>
</batch:step>
于 2012-09-28T09:39:48.537 に答える