0
在執行彈簧批處理時,我正面臨着一個奇怪的情況。Spring批處理:OnSkipInWrite打印日誌兩次?怎麼樣 ?
@OnSkipInWrite
public void onSkipInWrite(Object item, Throwable exception) {
AppLog.warn(AppConstants.CALLER, "Skipping Customer Id:"+ item.getCustomer().getCustomerId()+"\n" + exception.toString());
}
我不知道爲什麼日誌:我已配置我的作業步驟執行使用「可跳過的異常類」作爲
<step id="prepareFileStep" next="fillRecordsCounterStep">
<tasklet>
<chunk reader="stagingIdReader" writer="customerIdRecordCompWriter" commit-interval="50" skip-limit="200">
<streams>
<stream ref="flatFileRecordWriter" />
</streams>
<skippable-exception-classes>
<include class="java.lang.Exception" />
</skippable-exception-classes>
</chunk>
<listeners>
<listener ref="prepareFlatFileSkipListener" />
<listener ref="prepareFlatFileStepListener" />
</listeners>
</tasklet>
而且我onSkipInWrite()作爲實施文件已經打印了兩次跳過的項目,當我調試它時,它只執行一次?請建議我的朋友修復...