當我定義使用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