簡體   English   中英

如何在 Spring 批處理中使用 ResourceItemReader

[英]How do I use ResourceItemReader in Spring Batch

I'm new to Spring Batch and I need to create a custom reader using ResourceItemReader to get only resources names from.xml and.pdf files and pass to a class that represents them.

例如:

CustomReader read -> C:\teste\teste.xml, C:\teste\teste.pdf -> Populate in Class Domain their resources.

Remering我不需要打開文件,只需獲取資源即可。

知道我該怎么做嗎?

謝謝!!

我需要使用 ResourceItemReader 創建一個自定義閱讀器,以便僅從.xml 和.pdf 文件中獲取資源名稱

您不需要自定義閱讀器。 您可以過濾資源並僅將您想要的資源傳遞給讀者:

Resource[] resources = .. // create an array of only pdf and xml resources
ResourcesItemReader reader = new ResourcesItemReader();
reader.setRresources(resources);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM