简体   繁体   中英

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.

For example:

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

Remering that I don't need to open the file, just get the resources.

Any idea how I could do?

Thanks!!

I need to create a custom reader using ResourceItemReader to get only resources names from.xml and.pdf files

You don't need a custom reader for that. You can filter resources and pass only the ones you want to the reader:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM